wsanchez
asked on
Implementing IP/Name-based Virtual Servers etc.
I am trying to implement mixed IP/Name-based virtual servers on my RedHat 6.0 linux machine but I can't seem to make it work. I tried the examples in the apache documentation but it did not work. Other than placing VirtualHost declarations in the httpd.conf file, are there other config files that i need to modify for the virtual servers to work?
The linux box i am working on is connected to a LAN whose domain name i do not want to use. I just need to be connected so that i could have access to the internet. Other than that, i don't need to be connected to this LAN and given the choice, I wouldn't. I am having problems because of this connection to the LAN. Whenever I try to access my local web server (localhost.localdomain), i need to type the IP address to access it. If I type the localhost name, it first searches in the DNS located in the LAN server. How could I fix this so that it would need to check the LAN server DNS first if the host i type is the local host?
To summarize, my questions are:
- what are the config files that i need to modify and how should they be modified in order to implement virtual servers?
- how can i make my server check the local machine first before going to the LAN server DNS?
Thanks.
The linux box i am working on is connected to a LAN whose domain name i do not want to use. I just need to be connected so that i could have access to the internet. Other than that, i don't need to be connected to this LAN and given the choice, I wouldn't. I am having problems because of this connection to the LAN. Whenever I try to access my local web server (localhost.localdomain), i need to type the IP address to access it. If I type the localhost name, it first searches in the DNS located in the LAN server. How could I fix this so that it would need to check the LAN server DNS first if the host i type is the local host?
To summarize, my questions are:
- what are the config files that i need to modify and how should they be modified in order to implement virtual servers?
- how can i make my server check the local machine first before going to the LAN server DNS?
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
hosts: files nisplus nis dns
Which says that the system should look in the local hosts file before consulting the DNS. So if you have the entry:
127.0.0.1 localhost.localdomain localhost
in your /etc/hosts file you won't use dns to resolve that name. There also needs to be a separate entry for the official name of the system, perhaps something like:
111.222.333.444 my-offical.name.com my-official
where the IP is that assiged to your system (assuming a static IP) and the FQDN is that as returned by an nslookup of your IP. If you have a dynamically assigned IP, the DHCP process should take care of the hostname for you.
As to creating virtual servers. You can create any named virtual servers that you like in Apache. If you make aliases in your hosts file for those names, like:
111.222.333.444 my-offical.name.com my-official virt1.srv.com virt2.srvit.com
then from your system, and your system only, you'll be able to access URLs that use those FQDNs. If you wish to access virtual servers from other than the local system, records must be added to the DNS server(s) that host those virtual domains to point to your system.