KevinReichard
07-18-2002, 09:29 AM
These talkbacks are in response to the article Apache Guide: Setting up Virtual Hosts (http://www.serverwatch.com/stypes/servers/article.php/1127571).
Todd writes:
How does Name based VH affect a domain that needs an MX record? One would have to go with IP based VH, I assume, right?
Rich Bowen responds:
There isn't necessarily any connection between how you handle your MX records, and which method of virtual hosting you choose to do. You can also do "virtual hosting" with Sendmail - hosting several domains mail on one server. Look for documentation on the virtusertable file.
David Taylor responds:
Dude MX records are totally separate, in that they point to the mail server for that domain which is usually not the same as the http server. Even so suppose you are running mail and http for a number of domains, this is handled by the mail server not the http server.
asad writes:
Is there some way you can make ssl work withn name based virutal hosts ? I know that this is supposed to be impossible with name based virutal hosts and you are supposed to use IP based virutal hosts instead but I am in a situation where I can not use IP's (no it has nothing to do with nating or me being out of IP's). I can redirect the incoming traffic based on ports but can I mix ports and name based virutal hosts so that I can tell which host is supposed to get the ssl traffic based on which port it receives the traffic?
Dave McDuff responds
We have one machine with a SSL that is namebased and IP's pooled for the ssl only. We could not get it to work any other way.
You must also have a wildcard ssl certificate and the IP# are assigned to subdomains of the ssl and works great.
Peter Peltonen responds:
Let me get this straight:
You have one machine with single IP and multiple DNS names pointing to that IP.
What do you mean with "IP's pooled for the ssl only"?
You have an extra IP for the SSL connection? How do you redirect that to a virtual host? Could you post your config file?
Gus Thompson writes:
I need detailed examples on how to setup Apache and create 3 virtual hosts. I have tried and read everything at www.apache.org and www.apachetoday.com. I am still having problems. At first I couldn't resolve the www.yourdomain.com 's (fixed)
Now I can't get the correct page to be served, just the default(localhost) I'm testing this locally not on the web, yet.
Any information and help would be appreciated.
Tommy responds:
I Just set up apache on win xp with 2 virtual host sites. search apache today for virtual host, then read setting up virtual host. it has step by step examples for 3 name or ip based virtual host. works great as long as u have your DNS pointing to your machines IP the will be handling the virtual host.
Paul Mackenzie responds:
Okay don't know if this applies to most but I had everything setup correctly including DNS but it still didn't work. What I found out from IRC was that you have to have "UseCanonicalName On" in your httpd.conf this was what resolved my issues.
airsuam writes:
Is there any tools that can manage the virtual hosts simpler ?
maybe web-based configuration?
Omar Nessar responds:
You can use the web-based version of linuxconf.
P.S. under linux only!
[I]Eddy writes:
Try web-min (http://www.webmin.com)
Pierre Abbat writes:
To do virtual hosts behind a firewall, you have to set NameVirtualHost to the webserver's internal address, and <VirtualHost> likewise, but set ServerName to the external name, which looks up to the external address. If you say <VirtualHost external.addr>, it won't work, because Apache will then look for web requests on the external address, which will never come.
RA writes:
This is a good article, but with respect to the differences between Name-based vs IP-based Virtual Hosting, you state that: "These are configuration differences on the server, and are not visible to the client--that is, there is no way that the user can tell what sort of virtual host they are using. Or even that they are using a virtual host, for that matter." Isn't it true that under certain circumstances, that Name-based virtual hosting does not work as intended, so that the client is not sent to the intended domain name? My understanding is that Name-based Virtual Hosting is not 100% fail safe, i.e., perhaps because certain browsers don't comply with certain protocols. Am I mistaken? I hope you're right because it sure would make things a lot easier.
Rich Bowen responds:
No, you're not mistaken, but it's almost irrelevant. The "certain browsers" are things like Netscape 2.0 and earlier, IE 1.0, and various other browsers of about that age. (No, I'm not sure about those version numbers.) If you look at browser statistics, you'll see that the effected population is a tiny percentage of the whole. Now, whether it is worth your time to compensate for that tiny percentage is a decision that you'll have to make yourself.
If you are truly concerned about this tiny sub-population, you need to look at the ServerPath directive - http://www.apache.org/docs/mod/core.html#serverpath - which allows an older browser to access the virtual host even though they cannot correctly pass the hostname information to the server. To be honest, I've never used it myself.
Marc writes:
I need to set up 2 web sites (maybe more as time goes on...) on a laptop for demo purposes. Since this is a non-networked laptop, the only domain I can use is LocalHost (127.0.0.1). This works fine for just one site if I don't use VirtualHosts but as soon as I try to set some up, Apache no longer finds anything!!
Using folder Aliases is not a viable option since these are copies of live sites and they cannot feasably be remapped for virtual folders.
Phil responds:
For WinNT, W2K and XP, lok for the file "hosts". It should be under your windows directory (windows or winnt)\system32\drivers\etc
There isn't an extension on this file, and it is plain text and can be edited in notepad. If this file does not exist, you can create it. The format of the file is:
[name]
Example:
127.0.0.1 localhost
123.45.67.8 web.test
123.45.67.8 web.live
Note that you can enter the same i address multiple times. This is used by windows to resolve names. Once you've saved the file, you can test what you have enetered by going to a command prompt and typing "ping web.live". You should see the ip address that "web.live" maps to. All you have to do now is configure Apache to take adavantage... :-)
[I]Haris responds:
Just define hostname as many as you want in hosts file like this:
127.0.0.1 localhost my.site.com your.site.com www.demo.org
Dwayne F. writes:
I have my httpd.conf file set up for virtual hosts. I currently have a project to set up 4 web sites on one linx box with 4 seperate IP's. I followed ever step I could from apache.org and this site, and I still cannot get the hosts to work. The DNS entries were made by a T1 provider and they show to point to the correct IP addresses. I set up the VirtualHosts like follows:
ServerName www.abc.com
ServerAdmin web@abc.com
DocumentRoot /httpd/html/abc
ServerName www.acb.com
ServerAdmin web@acb.com
DocumentRoot /httpd/html/acb
ServerName www.cba.com
ServerAdmin web@cba.com
DocumentRoot /httpd/html/cba
ServerName www.cab.com
ServerAdmin web@sab.com
DocumentRoot /httpd/html/cab
Is there anything wrong? I get the default host to run (www.abc.com), which is also defined as the server web site in the first section of the httpd.conf file, but none of the other web sites show up. I am not behind a firewall, and It operates off of the default web server port 80. PLEASE HELP! I cannot find an answer anywhere and I've tried a million things! It has to work though...
Nic responds:
Hi I had the same problem. I solved it by adding the line ServerAlias 'name' in the virtual host description.
Todd writes:
How does Name based VH affect a domain that needs an MX record? One would have to go with IP based VH, I assume, right?
Rich Bowen responds:
There isn't necessarily any connection between how you handle your MX records, and which method of virtual hosting you choose to do. You can also do "virtual hosting" with Sendmail - hosting several domains mail on one server. Look for documentation on the virtusertable file.
David Taylor responds:
Dude MX records are totally separate, in that they point to the mail server for that domain which is usually not the same as the http server. Even so suppose you are running mail and http for a number of domains, this is handled by the mail server not the http server.
asad writes:
Is there some way you can make ssl work withn name based virutal hosts ? I know that this is supposed to be impossible with name based virutal hosts and you are supposed to use IP based virutal hosts instead but I am in a situation where I can not use IP's (no it has nothing to do with nating or me being out of IP's). I can redirect the incoming traffic based on ports but can I mix ports and name based virutal hosts so that I can tell which host is supposed to get the ssl traffic based on which port it receives the traffic?
Dave McDuff responds
We have one machine with a SSL that is namebased and IP's pooled for the ssl only. We could not get it to work any other way.
You must also have a wildcard ssl certificate and the IP# are assigned to subdomains of the ssl and works great.
Peter Peltonen responds:
Let me get this straight:
You have one machine with single IP and multiple DNS names pointing to that IP.
What do you mean with "IP's pooled for the ssl only"?
You have an extra IP for the SSL connection? How do you redirect that to a virtual host? Could you post your config file?
Gus Thompson writes:
I need detailed examples on how to setup Apache and create 3 virtual hosts. I have tried and read everything at www.apache.org and www.apachetoday.com. I am still having problems. At first I couldn't resolve the www.yourdomain.com 's (fixed)
Now I can't get the correct page to be served, just the default(localhost) I'm testing this locally not on the web, yet.
Any information and help would be appreciated.
Tommy responds:
I Just set up apache on win xp with 2 virtual host sites. search apache today for virtual host, then read setting up virtual host. it has step by step examples for 3 name or ip based virtual host. works great as long as u have your DNS pointing to your machines IP the will be handling the virtual host.
Paul Mackenzie responds:
Okay don't know if this applies to most but I had everything setup correctly including DNS but it still didn't work. What I found out from IRC was that you have to have "UseCanonicalName On" in your httpd.conf this was what resolved my issues.
airsuam writes:
Is there any tools that can manage the virtual hosts simpler ?
maybe web-based configuration?
Omar Nessar responds:
You can use the web-based version of linuxconf.
P.S. under linux only!
[I]Eddy writes:
Try web-min (http://www.webmin.com)
Pierre Abbat writes:
To do virtual hosts behind a firewall, you have to set NameVirtualHost to the webserver's internal address, and <VirtualHost> likewise, but set ServerName to the external name, which looks up to the external address. If you say <VirtualHost external.addr>, it won't work, because Apache will then look for web requests on the external address, which will never come.
RA writes:
This is a good article, but with respect to the differences between Name-based vs IP-based Virtual Hosting, you state that: "These are configuration differences on the server, and are not visible to the client--that is, there is no way that the user can tell what sort of virtual host they are using. Or even that they are using a virtual host, for that matter." Isn't it true that under certain circumstances, that Name-based virtual hosting does not work as intended, so that the client is not sent to the intended domain name? My understanding is that Name-based Virtual Hosting is not 100% fail safe, i.e., perhaps because certain browsers don't comply with certain protocols. Am I mistaken? I hope you're right because it sure would make things a lot easier.
Rich Bowen responds:
No, you're not mistaken, but it's almost irrelevant. The "certain browsers" are things like Netscape 2.0 and earlier, IE 1.0, and various other browsers of about that age. (No, I'm not sure about those version numbers.) If you look at browser statistics, you'll see that the effected population is a tiny percentage of the whole. Now, whether it is worth your time to compensate for that tiny percentage is a decision that you'll have to make yourself.
If you are truly concerned about this tiny sub-population, you need to look at the ServerPath directive - http://www.apache.org/docs/mod/core.html#serverpath - which allows an older browser to access the virtual host even though they cannot correctly pass the hostname information to the server. To be honest, I've never used it myself.
Marc writes:
I need to set up 2 web sites (maybe more as time goes on...) on a laptop for demo purposes. Since this is a non-networked laptop, the only domain I can use is LocalHost (127.0.0.1). This works fine for just one site if I don't use VirtualHosts but as soon as I try to set some up, Apache no longer finds anything!!
Using folder Aliases is not a viable option since these are copies of live sites and they cannot feasably be remapped for virtual folders.
Phil responds:
For WinNT, W2K and XP, lok for the file "hosts". It should be under your windows directory (windows or winnt)\system32\drivers\etc
There isn't an extension on this file, and it is plain text and can be edited in notepad. If this file does not exist, you can create it. The format of the file is:
[name]
Example:
127.0.0.1 localhost
123.45.67.8 web.test
123.45.67.8 web.live
Note that you can enter the same i address multiple times. This is used by windows to resolve names. Once you've saved the file, you can test what you have enetered by going to a command prompt and typing "ping web.live". You should see the ip address that "web.live" maps to. All you have to do now is configure Apache to take adavantage... :-)
[I]Haris responds:
Just define hostname as many as you want in hosts file like this:
127.0.0.1 localhost my.site.com your.site.com www.demo.org
Dwayne F. writes:
I have my httpd.conf file set up for virtual hosts. I currently have a project to set up 4 web sites on one linx box with 4 seperate IP's. I followed ever step I could from apache.org and this site, and I still cannot get the hosts to work. The DNS entries were made by a T1 provider and they show to point to the correct IP addresses. I set up the VirtualHosts like follows:
ServerName www.abc.com
ServerAdmin web@abc.com
DocumentRoot /httpd/html/abc
ServerName www.acb.com
ServerAdmin web@acb.com
DocumentRoot /httpd/html/acb
ServerName www.cba.com
ServerAdmin web@cba.com
DocumentRoot /httpd/html/cba
ServerName www.cab.com
ServerAdmin web@sab.com
DocumentRoot /httpd/html/cab
Is there anything wrong? I get the default host to run (www.abc.com), which is also defined as the server web site in the first section of the httpd.conf file, but none of the other web sites show up. I am not behind a firewall, and It operates off of the default web server port 80. PLEASE HELP! I cannot find an answer anywhere and I've tried a million things! It has to work though...
Nic responds:
Hi I had the same problem. I solved it by adding the line ServerAlias 'name' in the virtual host description.