Vhost problem with any non-localmachine request
May 26, 2010 10:06 AM Subscribe
What am I doing wrong with this virtualhost setup that's preventing requests from other machines from using it?
So I've made up a domain, mydomain.com, as this code I've inherited won't play well with relative URLs. In my vhosts config, I have (Sorry, assume proper angle brackets around virtualhost and directory):
NameVirtualHost *:80
virtualhost
DocumentRoot "C:/xampp/htdocs"
/virtualhost
virtualhost
ServerName mydomain.com
DocumentRoot "C:/xampp/htdocs/mydomain.com/"
ScriptAlias /cgi-bin/ "C:/xampp/htdocs/mydomain.com/cgi-bin/"
directory
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
/directory
/virtualhost
In my windows hosts file on the host machine, I have mydomain.com pointing to 127.0.0.1, and it works. If I change it to point to the machine's network IP, or my public IP, it doesn't work.
Given that the 2nd machine can only use the network or public IP, it won't work either.
I need to be able to let other people on the internet see this site.
I'm no networking person, but am begging to think this is an issue with my router at home. All requests made through any kind of network IP seem to just come through and hit my catchall directive instead of seeing the virtual host.
Any help would be appreciated, and any more info required is available.
Misc info:
Apache 2.2 via a Xampp install
Host is Windows 7
Router is a Dlink DIR-655
So I've made up a domain, mydomain.com, as this code I've inherited won't play well with relative URLs. In my vhosts config, I have (Sorry, assume proper angle brackets around virtualhost and directory):
NameVirtualHost *:80
virtualhost
DocumentRoot "C:/xampp/htdocs"
/virtualhost
virtualhost
ServerName mydomain.com
DocumentRoot "C:/xampp/htdocs/mydomain.com/"
ScriptAlias /cgi-bin/ "C:/xampp/htdocs/mydomain.com/cgi-bin/"
directory
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
/directory
/virtualhost
In my windows hosts file on the host machine, I have mydomain.com pointing to 127.0.0.1, and it works. If I change it to point to the machine's network IP, or my public IP, it doesn't work.
Given that the 2nd machine can only use the network or public IP, it won't work either.
I need to be able to let other people on the internet see this site.
I'm no networking person, but am begging to think this is an issue with my router at home. All requests made through any kind of network IP seem to just come through and hit my catchall directive instead of seeing the virtual host.
Any help would be appreciated, and any more info required is available.
Misc info:
Apache 2.2 via a Xampp install
Host is Windows 7
Router is a Dlink DIR-655
Response by poster: I have a virtual server setup routing all traffic directed at my public IP to that machine's address.
But also, trying to do mydomain.com => 192.168.0.75 on another machine on the local network doesn't work either.
posted by nerhael at 10:16 AM on May 26, 2010
But also, trying to do mydomain.com => 192.168.0.75 on another machine on the local network doesn't work either.
posted by nerhael at 10:16 AM on May 26, 2010
When you say 'doesn't work', does that mean that you get nothing? Or that you get the default virtualhost instead of mydomain.com? I'm assuming you have Apache set to listen on 192.168.0.75. (If that's the actual IP bound to the box.)
posted by lholladay at 10:25 AM on May 26, 2010
posted by lholladay at 10:25 AM on May 26, 2010
Response by poster: Sorry yes, by doesn't work I mean that it goes to the default virtualhost instead of where I have mydomain.com setup to goto.
I have other sites that don't use a virtual host that work fine from anywhere just using the public IP.
posted by nerhael at 10:33 AM on May 26, 2010
I have other sites that don't use a virtual host that work fine from anywhere just using the public IP.
posted by nerhael at 10:33 AM on May 26, 2010
Best answer: I looked through some of my configs, and this is how I have things set up:
posted by lholladay at 11:30 AM on May 26, 2010
I know Apache can be very idiosyncratic about syntax in these cases. Maybe the minor config differences are causing your trouble?NameVirtualHost *:80 <VirtualHost *:80> ServerName www.domain.com DocumentRoot /path/to/files </VirtualHost> <VirtualHost *:80> ServerName www.domain2.com DocumentRoot /path/to/morefiles </VirtualHost>
posted by lholladay at 11:30 AM on May 26, 2010
Response by poster: That worked... I had always thought you had to include the domain name in the virtualhost tag itself as that's what I thought it did the lookup based on.
Apache can be oh so fun.
Thanks so much for the help.
posted by nerhael at 11:49 AM on May 26, 2010
Apache can be oh so fun.
Thanks so much for the help.
posted by nerhael at 11:49 AM on May 26, 2010
This thread is closed to new comments.
posted by lholladay at 10:13 AM on May 26, 2010