Understanding vhosts settings

Posted by Matt on Server Fault See other posts from Server Fault or by Matt
Published on 2011-02-07T02:31:41Z Indexed on 2011/02/07 7:27 UTC
Read the original article Hit count: 528

Filed under:
|
|

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 [email protected]
      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 [email protected]
      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

© Server Fault or respective owner

Related posts about apache

Related posts about ubuntu