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.

I keep adding more vhosts and enabling them but all the sites always do to the default vhost in sites-available

here is what the default kind of looks like with me only changing the ip for security reasons

 <VirtualHost 167.889.88.88:80>
     ServerAdmin webmaster@localhost

     DocumentRoot /var/www
     <Directory />
             Options FollowSymLinks
             AllowOverride None
     </Directory>
     <Directory /var/www/>
             Options Indexes FollowSymLinks MultiViews
             AllowOverride None
             Order allow,deny
             allow from all
     </Directory>

     ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
     <Directory "/usr/lib/cgi-bin">
             AllowOverride None
             Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
             Order allow,deny
             Allow from all
     </Directory>

     ErrorLog /var/log/apache2/error.log

     # Possible values include: debug, info, notice, warn, error, crit,
     # alert, emerg.
     LogLevel warn

     CustomLog /var/log/apache2/access.log combined

 Alias /doc/ "/usr/share/doc/"
 <Directory "/usr/share/doc/">
     Options Indexes MultiViews FollowSymLinks
     AllowOverride None
     Order deny,allow
     Deny from all
     Allow from 127.0.0.0/255.0.0.0 ::1/128
 </Directory>

 </VirtualHost>

and here is my other which i named some-site.net

 <VirtualHost *:80>
     ServerName some-site.net
     DocumentRoot "/var/www/vhosts/somesite.com/http/"

     <Directory "/var/www/vhosts/somesite.com/http/">
             AllowOverride all
             Options -MultiViews
     </Directory>
 </VirtualHost>

and it turned on my this command

sudo a2ensite some-site.net
 Enabling site some-site.net.
 Run '/etc/init.d/apache2 reload' to activate new configuration!

then i reloaded

/etc/init.d/apache2 reload
* Reloading web server config apache2
 ...done.

but when i visit the url some-site.net i get the index page that is for the default vhost...what am i doing wrong

share|improve this question
1  
Maybe something is missing from the configuration you've posted here, but I don't see any <VirtualHost> blocks. –  larsks Jan 26 '11 at 16:13
    
i changed my blocks to show the correct info –  Matt Jan 26 '11 at 16:20

3 Answers 3

up vote 1 down vote accepted

First guess, you need the NameVirtualHost statement in your httpd.conf file. Also, as a sanity check, I'm assuming you have the correct blocks?

What do you get when you run apachectl -S ?

share|improve this answer
    
i get apachectl -S bash: apachectl: command not found –  Matt Jan 26 '11 at 16:18
    
look at the virtual hosts now, i changed them to show you the VirtualHost statements –  Matt Jan 26 '11 at 16:20
    
do i actually put the NameVirtualHost in the httpd.conf or in the new vhost file.... –  Matt Jan 26 '11 at 16:22
    
it goes in the main server config (not the vhost or directory blocks) –  DTest Jan 26 '11 at 16:33
    
but what goes there ....so lets say i have 3 sites on the same server do i need 3 NameVirtualHost's –  Matt Jan 26 '11 at 16:35

In your first block you do not have a ServerName specified and Apache is matching the incoming request to the IP. The problem is with the mix of IP and Name based virtual server configuration.

To further rule out the problem out a ServerName directive in your virtual server directive which start as follows.

VirtualHost 167.889.88.88:80

share|improve this answer
    
how do i resolve this issue then –  Matt Jan 26 '11 at 16:47
    
In the first section use the name of the domain which you want to use as default domain incase of any requests that come to the server. Apache defaults to the first Server block when it can't find a matching server block. –  Sameer Jan 26 '11 at 16:57

Add following lines in /etc/hosts file:

localhost some-site.net
share|improve this answer

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.