Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an OpenVZ VPS running Ubuntu 10.04, and a standard install of Apache2, PHP, the usual. I am trying to set up multiple hostname-based VHosts to allow all of my users to have access to some webspace, but when I define more than 1 VirtualHost entry in my httpd.conf, Apache will not start. Using 'service apache2 start' reports a failure, and 'apache2ctl start' runs fine, but apache isn't running after it finishes.

At the moment, I'm only trying to get 2 VHosts working, a real domain name, and a similar No-IP subdomain. Here is my httpd.conf:

NameVirtualHost *:80
Listen 80

<VirtualHost *:80>
  ServerAlias *
  DocumentRoot /home/user1/www-pub
  LogFormat "%h %l %u %t \"%r\" %>s %b" common
  CustomLog /home/user1/logs/access.log common
  ErrorLog /home/user1/logs/error.log

  DocumentRoot /home/user2/www-pub
  LogFormat "%h %l %u %t \"%r\" %>s %b" common
  CustomLog /home/user2/logs/access.log common
  ErrorLog /home/user2/logs/error.log

Am I missing something here? I've looked in the documentation, and as far as I can tell, everything should be working fine.

share|improve this question
ERROR LOG ERROR LOG ERROR LOG – Ignacio Vazquez-Abrams May 5 '11 at 17:39
Where can I find this error log? The only logs I can find are the access and error logs for http requests. – James May 5 '11 at 18:19
up vote 1 down vote accepted

apache2ctl configtest will show you why it isn't working.

My guess is that you cannot resolve, or it resolves to an IP that isn't bound to a nic on your computer but that is only a guess, Post the output of the configtest and we should be able to better help...

If you are only doing name based virtual hosting then change



<VirtualHost *:80>

which will tell apache to listen on all ips.

You should also check the error log, which is in /var/log/apache2/ by default. Open it and look for anything related to your virtual host.

share|improve this answer
This is not the case, the configtest passes. Also, changing that doesn't fix anything. :/ Regardless, here's the output: 'james@vps2:~$ sudo apache2ctl configtest apache2: Could not reliably determine the server's fully qualified domain name, using for ServerName Syntax OK' And yes, I know there's nothing at the IP, I'll add a redirect just as soon as I fix the VHost problem – James May 5 '11 at 18:17
well if the configtest passes, apache should start. Look in the errorlog (same errorlog as http requests) and it should have a line that says why it didn't start. – Doon May 5 '11 at 18:30
Well, I found it. The log directory for the second VHost was never created. Thanks for your help Doon! – James May 5 '11 at 18:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .