Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hey, can someone help me out here, I'm trying to run multiple sites on my Webserver with 1 IP address but it's
not working, when I type in www.site2.com it shows me the first site, here how I have my httpd.conf file setup.Windows XP, Apache 2.0.52
NameVirtualHost 127.0.0.1:80
<VirtualHost 127.0.0.1:80>
ServerName site.com
ServerAlias www.site.com
Serveradmin webmaster@site.com
DocumentRoot "C:\Program Files\apache Group\Apache2\htdocs"
ErrorLog logs\site.com_error_log
CustomLog logs\site.com-access_log common
</VirtualHost><VirtualHost 127.0.0.1:80>
ServerName site2.com
ServerAlias www.site2.com
Serveradmin webmaster@site2.com
DocumentRoot "C:\Program Files\Apache Group\Apache2\htdocs2"
ErrorLog logs\site2.com_error_log
CustomLog logs\site2.com-access_log common
</VirtualHost>

Are you accessing the sites from the webserver itself, or from another computer? If your apache.conf file is literally configured like what you posted, site2.com will only be accessible from the webserver because of the 127.0.0.1 address you used. Any other computer trying to access site2 will be shown the default site, if one is configured. That could explain why you are seeing site.com instead of site2.com if site.com is configured as the default site.

I'm accessing the sites from my webserver, I've just changed the ip from 127.0.0.1 to my wan ip address and it seem to work from my webserver, haven't try it yet on other computer, but since I have a dynamic
ip address do I have to keep changing the ip from the httpd.conf file everything time my
ip changes? or there other way around this?

I think it will probably work from anywhere now, if it's working from the webserver. the 127.0.0.1 was probably confusing apache.
Unless you have multiple IP addresses bound to your webserver's network card(s) and you want to host different websites on each address, you can use the syntax <VirtualHost *:80>. This will make apache listen on any bound IP address instead of just the one you specify. Then if the address changes, it doesn't matter and apache will still listen on it.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |