0

Hi,
I am configuring my staging server apache with virtual host.
Whenever i try to access the site with host entry in my system(hosts file)
it's always displaying first site in vhost. i am not able to access other sites.
always i am getting www.ocms.com site , i am not able to access www.uscms.com site

my httpd.conf details are below

NameVirtualHost *.80
<VirtualHost *:80>
   DirectoryIndex index.php
	DocumentRoot /cmsdata/cms/sites/home
	ServerName www.ocms.com
    ErrorLog /usr/local/apache/logs/o-error_log
	CustomLog /usr/local/apache/logs/o-access_log combined
</VirtualHost>

<VirtualHost *:80>
    DirectoryIndex index.php
	DocumentRoot /cmsdata/cms/sites/us
	ServerName www.uscms.com
    ErrorLog /usr/local/apache/logs/ous-error_log
	CustomLog /usr/local/apache/logs/ous-access_log combined
</VirtualHost>
4
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by tracedinesh
0

Look at your apache httpd.conf if the line that includes your vhosts file isn't commented.

Try to use:

NameVirtualHost *
<VirtualHost *>
	DocumentRoot /cmsdata/cms/sites/home
	ServerName www.ocms.com
	ErrorLog /usr/local/apache/logs/o-error_log
	CustomLog /usr/local/apache/logs/o-access_log combined
</VirtualHost>

<VirtualHost *>
	DocumentRoot /cmsdata/cms/sites/us
	ServerName www.uscms.com
	ErrorLog /usr/local/apache/logs/ous-error_log
	CustomLog /usr/local/apache/logs/ous-access_log combined
</VirtualHost>

also add in your /etc/hosts:

127.0.0.1    www.ocms.com
127.0.0.1    www.uscms.com

With these settings should be ok, at least working from the same machine.

0

Haii am new to this forum.
i also have this issue and i solved by giving ip instead of '*' in both vitualhosts
and in Namedvirtualhost entry
eg:<VirtualHost 127.0.0.1:80>
also add ip in etc/hosts

Edited by mike_2000_17: Fixed formatting

0

Hi,
Look at your httpd.conf file and search for Listen directive
if its commanted please uncomment it
#Listen 80
to
Listen 80

don't forget to restart your apache service

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.