Computing.Net > Forums > Web Development > Virtualhost not working.

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Virtualhost not working.

Reply to Message Icon

Name: salchipapi
Date: April 18, 2005 at 11:33:17 Pacific
OS: Win XP
CPU/Ram: AMD 1.2, 224
Comment:

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>



Sponsored Link
Ads by Google

Response Number 1
Name: jimminy
Date: April 18, 2005 at 12:32:54 Pacific
Reply:

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.


0

Response Number 2
Name: salchipapi
Date: April 18, 2005 at 13:35:39 Pacific
Reply:

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?


0

Response Number 3
Name: jimminy
Date: April 18, 2005 at 13:45:24 Pacific
Reply:

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.


0

Response Number 4
Name: salchipapi
Date: April 18, 2005 at 14:05:21 Pacific
Reply:

Ok I've changed it to *:80 and worked
Thanks.


0

Response Number 5
Name: jimminy
Date: April 18, 2005 at 14:18:51 Pacific
Reply:

Cool. So when do we get to see the website? ;)


0

Related Posts

See More



Response Number 6
Name: salchipapi
Date: April 20, 2005 at 20:57:37 Pacific
Reply:

www.eurostylemusic.com, second site is not up yet still working on it.


0

Response Number 7
Name: jimminy
Date: April 20, 2005 at 21:01:01 Pacific
Reply:

Cool. I didn't expect you would post back. Site looks good :)


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

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


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: Virtualhost not working.

Java Script not working on web site www.computing.net/answers/webdevel/java-script-not-working-on-web-site/1693.html

Ctrl key not working in DW8 www.computing.net/answers/webdevel/ctrl-key-not-working-in-dw8/2213.html

php Guestbook not working properly www.computing.net/answers/webdevel/php-guestbook-not-working-properly/719.html