Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to run IP-based VirtualHosting behind a Firewall

VirtualHosts

How to run IP-based VirtualHosting behind a Firewall

by  rninja  Posted    (Edited  )
Many people nowadays are getting router/switch/dhcp/firewall combo boxes for DSL and Cable. A major problem for most, is getting VirtualHosts recognized behind the firewall.

Here is the simplest way to get virtualhosts viewable that done.

1) Find out what the internal Ip (private Ip range) is of your router/switch/dhcp/firewall box and then find out what IP your server uses (not the ISP or external IP).

2) Assign all virtualhosts in your httpd.conf file as IP's, and set the NameVirtualHost directive.
EXAMPLE:
NameVirtualHost 192.168.0.100
<VirtualHost 192.168.0.100>
ServerName www.domain.com
ServerAdmin me@domain.com
DocumentRoot /home/httpd/domain
</VirtualHost>

NameVirtualHost 192.168.0.101
<VirtualHost 192.168.0.101>
ServerName www.domain2.com
ServerAdmin me@domain2.com
DocumentRoot /home/httpd/domain2
</VirtualHost>

3) Now you are able to view it by typing the servername or registered domain name. You may have to set up DNS (a whole other issue) in order to get everything to work properly, unless it's already set up by your ISP or other.

4) Everytime you add a new domain (virtualHost), just follow these steps and it should work properly. If you use IP based virtualhosting, it is a much more complicated issue, not to mention, you must set the ethernet card with routes and set up the interfaces for your usable IP range.

To retain NIC settings for internal Ip addresses, you will need to edit these files:

/etc/sysconfig/network
/etc/sysconfig/network-scripts/ifcfg-eth*

Hope this helps!!!


Written by RNINJA
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top