Apache subdomain not working

Posted by tandu on Server Fault See other posts from Server Fault or by tandu
Published on 2012-03-27T03:13:32Z Indexed on 2012/03/27 5:31 UTC
Read the original article Hit count: 468

Filed under:
|

I'm running apache on my local machine and I'm trying to create a subdomain, but it's not working. Here is what I have (stripped down):

<VirtualHost *:80>
   DocumentRoot /var/www/one
   ServerName one.localhost
</VirtualHost>
<VirtualHost *:80>
   DocumentRoot /var/www/two
   ServerName two.localhost
</VirtualHost>

I recently added one. The two entry has been around for a while, and it still works fine (displays the webpage when I go to two.localhost). In fact, I copied the entire two.localhost entry and simply changed two to one, but it's not working. I have tried each of the following:

* `apachectl -k graceful`
* `apachectl -k restart`
* `/etc/init.d/apache2 restart`
* `/etc/init.d/apache2 stop && !#:0 start`

Apache will complain if /var/www/one does not exist, so I know it's doing something, but when I visit one.localhost in my browser, the browser complains that nothing is there. I put an index.html file there and also tried going to one.localhost/index.html directly, and the browser still won't fine it. This is very perplexing since the entry I copied from two.localhost is exactly the same .. not only that, but if something were wrong I would expect to get a 500 rather than the browser not being able to find anything. The error_log also has nothing extra.

© Server Fault or respective owner

Related posts about apache2

Related posts about subdomain