Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am a newbie on redhat and 8.0 and I am trying make name based virtual hosting work.
Right now, any virtual host resolves to the default server and apparently and ignores the virtual host directives. My httpd.conf files contains the below although I've tried the NameVirtualHost different ways without result. It seems like no matter what I do any virtual host resolves to the default server:
I have tried a private IP, WAN IP listed in the dns entry, with and without port# in the VirtualHost line without success. I am running one static IP and trying to do virtual hosting for more than one domain.
Any Virtual names must be specified in <VirtualHost www.xxx.com > </VirtualHost> tags,
eg
<VirtualHost www.xxxx.com>
DocumentRoot /var/www/xxxx.com
ServerName www.xxxx.com
</VirtualHost>
I add "NameVirtualServer xx.xx.xx.xx" with my ip address to the httpd.conf to catch any direct ip requests.
The first <VirtualHost > specified will become the default this way.
The default pages are served when apache cannot find a matching name for the incoming request.
You must have a dns server with an exact matching name pointing to this ip address, so do
dig www.xxxx.com
and make sure you can resolve the exact VirtualHost names.
From a command line type "httpd -S" to check the VirtualHost configurations.
Last edited by peter_robb; 12-01-2002 at 10:59 AM.
Originally posted by peter_robb Any Virtual names must be specified in <VirtualHost www.xxx.com > </VirtualHost> tags,
eg
<VirtualHost www.xxxx.com>
DocumentRoot /var/www/xxxx.com
ServerName www.xxxx.com
</VirtualHost>
Not necessary. You can leave *
Quote:
I add "NameVirtualServer xx.xx.xx.xx" with my ip address to the httpd.conf to catch any direct ip requests.
I think this is his problem.
So, just uncomment the line with NameVirtualSever and restart apache.
Also, in new versions of Apache, you can put * after NameVirtualServer
Quote:
From a command line type "httpd -S" to check the VirtualHost configurations.
1. I was unable to use the NameVirtualServer directive as I got an error - evidently it's not configured for the version of apache that comes with redhat 8.0.
2. I tested as per your instructions but to no avail.
3. I wiped the box and completely reinstalled, using the gnome gui and the httpd tool provided and got the following results:
The default virtual server appears to work as name-based; however when I add a second virtual host, both the default virtual host as well as the newly created virtual host now reolve to the default server /var/www/html rather than the respective document root such as /var/www/xxxx.com directory...argghh.
Do you have a DNS record set up anywhere for this domain name? It doesn't have to be registered, but you do need someone's DNS pointed at your IP address.
Yes. thanks - it's on ns1.nbsweb.net; It's wierd but when I did not use the gnome gui tool and just edited httpd.conf based on the default virtual host created by the gnome gui tool...it works...
It's as if the gnome gui tool just did not work. It could create the default virtual host but not other virtual host. Only by imitating the syntax of the default virtual host entry, then editing it for the respective virtual host, it worked.
I'm disappointed in the httpd gnome gui - it didn't help me; it just got in the way. I might go ahead and just uninstall the gnome desktop even though I really like it.
Well thanks for the help from this Q & A session because I was able to piece things together and got my Virtual Hosting to work. Man I will never use the HTTPD server config tool again. Had to do it by hand. Anyway if you go to www.designtime.ca you will just see a logo and if you go to www.sablestrokes.ca you will see the logo as well as the page I am working on for someone. The exact code I used with Redhat 8 was:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.