Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Ok so i have a server and I want to put a few applications on and i am having vhost configuration problems. Here is what i have and I want some direction on what i am doing wrong...ok so the first file is /etc/apache2/ports.conf

NameVirtualHost 184.106.111.142:80
Listen 80

<IfModule mod_ssl.c>
    Listen 443
</IfModule>

<IfModule mod_gnutls.c>
    Listen 443
</IfModule>

then i have /etc/apache2/sites-available/somesite.com

<VirtualHost 184.106.111.142:80>
      ServerAdmin admin@someemail.com
      ServerName somesite.com
      ServerAlias www.somesite.com
      DocumentRoot /srv/www/somesite.com/
      ErrorLog /srv/www/somesite.com/logs/error.log
      CustomLog /srv/www/somesite.com/logs/access.log combined
        <Directory "/srv/www/somesite.com/">
                AllowOverride all
                Options -MultiViews
        </Directory>
</VirtualHost>

when i visit somesite.com everything works great but when i add another vhost and lets say thats named anothersite.com. So i have /etc/apache2/sites-available/anothersite.com

<VirtualHost 184.106.111.142:80>
      ServerAdmin admin@anotheremail.com
      ServerName anothersite.com
      ServerAlias www.anothersite.com
      DocumentRoot /srv/www/anothersite.com/
      ErrorLog /srv/www/anothersite.com/logs/error.log
      CustomLog /srv/www/anothersite.com/logs/access.log combined
        <Directory "/srv/www/anothersite.com/">
                AllowOverride all
                Options -MultiViews
        </Directory>
</VirtualHost>

then i run the following commands

>> sudo a2ensite anothersite.com
 Enabling site anothersite.com.
 Run '/etc/init.d/apache2 reload' to activate new configuration!
>> /etc/init.d/apache2 reload
 * Reloading web server config apache2
 ...done.

but when i visit anothersite.com or somesite.com they are both down..What is going on with the vhosts. Could it be the NameVirtualHost declaration with the ip or something...maybe my understanding of vhost settings is not clear. What i dont understand is why do both site now all the sudden not work at all.I would highly appreciate the clarity

By the way anothersite.com or somesite.com are the only things I changed to make it more readable

share|improve this question

migrated from stackoverflow.com Feb 7 '11 at 2:39

This question came from our site for professional and enthusiast programmers.

1  
belongs on ServerFault, and have you had a look at the apache error logs? –  tobyodavies Feb 7 '11 at 2:33
    
What does "down" mean? Are you getting an error? Something else? What's in the Apache error log? –  larsks Feb 7 '11 at 3:12
    
i mean that when i visit anothersite.com nothing happens and when i tail the access.log.. there is nothing happening –  Matt Feb 7 '11 at 3:14
add comment

1 Answer

up vote 1 down vote accepted

I test your config and all work. Use apache2 -S for debug:

# . /etc/apache2/envvars && apache2 -S
VirtualHost configuration:
184.106.111.142:80      is a NameVirtualHost
         default server somesite.com (/etc/apache2/sites-enabled/somesite.com:1)
         port 80 namevhost somesite.com (/etc/apache2/sites-enabled/somesite.com:1)
         port 80 namevhost anothersite.com  (/etc/apache2/sites-enabled/anothersite.com:1)
Syntax OK

Then open site in browser or CURL(wget don't set Host header):

# curl somesite.com
a
# curl anothersite.com
b
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.