I just setup an Apache 2.4 & PHP 5.5.6 on ubuntu 12.04
When I call the page on a web browser -> mysite.com/index.php
, the pages shows normally and works, but if i call the page mysite.com
(without the /index.php) i get the error 404
, the Apache does not load the index.php automatically.
I need to write this in navigation bar of the browser (the site have too an index.html
). My virtual host of mysite.conf
is:
<VirtualHost *:80>
ServerAdmin webmaster@mysite.org
DocumentRoot /home/alexbk/webs/mysite
ErrorLog /home/alexbk/webs/mysite/error.log
CustomLog /home/alexbk/webs/mysite/access.log combined
<Directory /home/alexbk/webs/mysite>
Options Indexes FollowSymLinks MultiViews
Require all granted
AllowOverride All
</Directory>
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet -->
The folder does not have and htacess file. I try change the apache2.conf
, but without luck.
Thanks for your help
The following should work for you:
<VirtualHost *:80>
ServerAdmin webmaster@mysite.org
DocumentRoot /home/alexbk/webs/mysite
ErrorLog /home/alexbk/webs/mysite/error.log
CustomLog /home/alexbk/webs/mysite/access.log combined
<Directory /home/alexbk/webs/mysite>
Options Indexes FollowSymLinks MultiViews
Require all granted
AllowOverride All
DirectoryIndex index.php
</Directory>
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet -->
EDIT:
If that doesn't work, go and edit /etc/apache2/mods-enabled/dir.conf and change it from:
<IfModule mod_dir.c>
DirectoryIndex index.html index.cgi index.pl index.xhtml index.htm
</IfModule>
to:
<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>
As a side note, if you can't fine the dir.conf file within the mods-enabled folder then you need to run the following command:
sudo a2enmod dir
Thanks to garry, for your help, my problem was that there are not a dir.load file in the mods-available folder then the command "sudo a2enmod dir" does not work, i need to create a dir.load file (with the line: LoadModule dir_module /usr/lib/apache2/modules/mod_dir.so); sure that the .so file exist and save into mods-available folder, then i can run "a2enmod dir" and works!!.