Click to See Complete Forum and Search --> : Apache problem


Dagda
02-07-2002, 10:35 AM
I run a web server and one of my virtual hosts is having a problem. when every I try and goto this site it takes me to a different site that I run. Here is part of my config file:

DocumentRoot "/var/www/html"


<VirtualHost IP>
DocumentRoot /home/site1/www/public_html
ServerName site1.com
ScriptAlias /cgi-bin/ /home/site1/www/public_html/cgi-bin/
ErrorLog /home/site1/www/logs/error-log
AgentLog /home/site1/www/logs/browser-log
TransferLog /home/site1/www/logs/access-log
RefererLog /home/site1/www/logs/referer-log
ServerAlias www.site1.com (http://www.site1.com)
</VirtualHost>


<VirtualHost IP>
DocumentRoot /home/site2.com/public_html
ServerName site2.com
ErrorLog /home/site2.com/logs/error-log
AgentLog /home/site2.com/logs/browser-log
TransferLog /home/site2.com/logs/access-log
RefererLog /home/site2.com/logs/referer-log
</VirtualHost>


<VirtualHost IP>
DocumentRoot /home/webmaster/www/site3.com/public_html
ServerName site3.com
ErrorLog /home/webmaster/www/site3.com/logs/error-log
AgentLog /home/webmaster/www/site3.com/logs/browser-log
TransferLog /home/webmaster/www/site3.com/logs/access-log
RefererLog /home/webmaster/www/site3.com/logs/referer-log
ServerAlias www.site3.com (http://www.site3.com)
</VirtualHost>


<VirtualHost IP>
DocumentRoot /home/site4.com/public_html
ServerName site4.com
ServerAlias www.site4.com (http://www.site4.com)
</VirtualHost>

Now when I go to www.site1.com (http://www.site1.com) it takes me to site1.com. When I go to site2.com it takes me to site2.com same with site3 but when I go to www.site4.com (http://www.site4.com) it takes me to site1. I use the same IP for all of these sites.

Please help

Dagda
02-07-2002, 11:04 AM
ok I fixed it but some how I don't think it should be working the way I fixed it.
Here is the site4.com.hosts file

$ttl 38400
site4.com. IN SOA igor.site.com. support.site.com. (
1012402468
10800
3600
604800
38400 )
site4.com. IN NS ns1.site.com.
site4.com. IN NS ns2.site.com.
site4.com. IN A *.*.*.58 www.site4.com. (http://www.site4.com.) IN A *.*.*.58
ftp.site4.com. IN A *.*.*.58
mail.site4.com. IN A *.*.*.58

and here is the virtualhost entry in the httpd.conf file:

<VirtualHost *.*.*.57>
DocumentRoot /home/site4.com/public_html
ServerName www.site4.com (http://www.site4.com)
ServerAlias site4.com
</VirtualHost>


and it works I have the DNS pointing to one IP and the virtual host setup on another IP but it works?

freebsd
02-08-2002, 01:31 AM
1) >> ScriptAlias /cgi-bin/ /home/site1/www/public_html/cgi-bin/

When you ScriptAlias'ed your cgi-bin, don't put it under your docroot, move it one dir up like:

/home/site1/www/cgi-bin/.

2) You need to figure out what's the IP for site4.com.

Dagda
02-08-2002, 06:34 PM
Originally posted by freebsd:
<STRONG>1) &gt;&gt; ScriptAlias /cgi-bin/ /home/site1/www/public_html/cgi-bin/

When you ScriptAlias'ed your cgi-bin, don't put it under your docroot, move it one dir up like:

/home/site1/www/cgi-bin/.

2) You need to figure out what's the IP for site4.com.</STRONG>


Thanks for the info. I figured out what the problem was. It was the DNS caching server here at work. it keep the old address not the new on so I got sent to the wrong site.