So I'm trying to set up my site with Apache on Ubuntu 14.04.
I have created a mydomain.com.conf
file in sites-available/
. It looks like this;
mydomain.com.conf
<VirtualHost *:80>
ServerName mydomain.com
ServerAlias www.mydomain.com
ServerAdmin admin@mydomain.com
DocumentRoot /var/www/mydomain.com/public_html
ErrorLog ${APACHE_LOG_DIR}/mydomain.com/error.log
CustomLog ${APACHE_LOG_DIR}/mydomain.com/access.log combined
</VirtualHost>
000-default.conf
<VirtualHost *:80>
ServerAdmin webmaster@localhost
#DocumentRoot /var/www
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
For some reason apache doesn't seem to read mydomain.com.conf
at all, it will always default to the configuration in 000-default.conf
.
When visting my site I get a 403 Forbidden response.
- I've enabled the site by
a2ensite mydomain.com
and reloaded Apache. apachectl configtest
returnsSyntax OK
The error.log
file for 000-default.conf
says
[Wed Sep 03 11:01:48.717652 2014] [autoindex:error] [pid 5869] [client 2.71.93.10:55718] AH01276: Cannot serve directory /var/www/: No matching DirectoryIndex (index.php,index.html,index.cgi,index.pl,index.xhtml,index.htm) found, and server-generated directory index forbidden by Options directive
while the error log & access log for mydomain.com
is empty.
My apache2.conf
does a IncludeOptional sites-enabled/*.conf
.
The security model in apache2.conf
looks like this;
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /var/www/>
DirectoryIndex index.php, index.html
AllowOverride None
Require all granted
</Directory>
What's wrong?