Sunday 29 April 2018

My Apache Webserver is not picking up my second named virtual hosts file.

So I have a website running on a lamp stack on Ubuntu 16.04.

I have two vhosts files...

000-default.conf:

<VirtualHost *:80> ServerName www.example.co.uk ServerAdmin admin@example.co.uk DocumentRoot /var/www/html/ ErrorLog ${APACHE_LOG_DIR}/site-a_error.log CustomLog ${APACHE_LOG_DIR}/site-a_access.log combined </VirtualHost> 

And moodle.example.co.uk.conf:

<VirtualHost *:80> ServerName moodle.example.co.uk ServerAdmin admin@example.co.uk DocumentRoot /var/www/moodle.example.co.uk/public_html ErrorLog ${APACHE_LOG_DIR}/site-b_error.log CustomLog ${APACHE_LOG_DIR}/site-b_access.log combined </VirtualHost> 

If I go to www.example.co.uk then I see the home page. Exactly as expected.

However if I go to moodle.example.co.uk I still see the homepage not the page stored in the DocumentRoot specified.

If I add a ServerAlias directive to the Moodle conf then it works fine.

Why does the ServerName directive not work?



Submitted April 29, 2018 at 02:46PM by Spacedementia87 https://ift.tt/2HzqJSF

No comments:

Post a Comment