Apache Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationApache Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 3rd, 2001, 11:36 AM
srcurtis srcurtis is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2001
Posts: 1 srcurtis User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Post Apache Virtual Hosts and Firewall

I have an apache server on my local 192.168.0 network at 192.168.0.205. I would like to try and keep the Apache server on my 192.168.0 network if possible although I would like to make the server available to the public. My public IP is routed to a firewall running on a NetWare box at 192.168.0.1 which also runs a local DNS.

Apache is configured for virtual hosts all which work fine on my local intranet.

I have set up public DNS to point my domain names to my public IP. The Netware firewall re-writes the packets and maps all traffic on port 80 or 443 to 192.168.0.205. When a request is made from a public IP the apache server always sends back the default page and the document root set as part of the virtual hosting is ignored (although it works fine locally).

In an attempt to resolve the problem I set up local DNS entries for the domain names that point to the 192.168.0.205 local linux box so that if Apache tries to do a reverse lookup it would always map to 192.168.0.205.

The linux box only knows about 192.168.0.205, it knows nothing of the public IP that public traffic comes in on. DNS has been set up to be resolved from the Netware box. The Netware box then returns a local IP for any DNS lookup's. I have even set up IN-ARPA's for reverse DNS.

I'm beginning to confuse myself... so I hope you are still with me!

Can anyone tell me how apache handles its virtual hosting or if I have missed anything or are attempting the impossible.

I know that what I am doing is messy.

Steve

Reply With Quote
  #2  
Old August 3rd, 2001, 01:18 PM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
>> The linux box only knows about 192.168.0.205, it knows nothing of the public IP that public traffic comes in on.

You need to setup your Apache on linux box to know your public IP by putting the IP in NameVirtualHost line explicitly.

To make your internal network able to reach the appropriate vhost domain, do the following:
1) Add/append box_name.domain.com to the ServerAlias line within <VirtualHost> block
2) box_name.domain.com must not be reachable by the outside world and it's resolved to 192.168.0.205.
3) Since you also run a local DNS, so setting hosts file on all boxes locally is not needed

You maybe a little confused, so here is an example:

Say my FreeBSD box has two NIC - 192.168.0.1 and 123.45.67.89. Its hostname was set to mail.domain.com (resolvable from outside). And I actually wanted my domain to be www.domain.com. 192.168.0.1 resolves to freebsd.domain.com (not reachable from outside, just internal network using hosts file). Also, I have a vhost called "www.vhost.com" resolvable from outside.

In /etc/hosts file and C:\Windows\hosts:

192.168.0.1 freebsd.domain.com freebsd vhost1.vhost.com

In httpd.conf:

ServerName mail.domain.com
UseCanonicalName Off
DocumentRoot "/www/htdocs"
...
NameVirtualHost *
<VirtualHost *>
DocumentRoot "/www/htdocs"
ServerName www.domain.com
ServerAlias domain.com freebsd.domain.com
...
...
</VirtualHost>

<VirtualHost *>
DocumentRoot "/www/vhosts/www.vhost.com/htdocs"
ServerName www.vhost.com
ServerAlias vhost.com vhost1.vhost.com #vhost1.vhost.com is resolvable internally
...
</VirtualHost>

With this setup, domain.com and www.domain.com resolve to 123.45.67.89 reachable from outside. freebsd.domain.com resolve to 192.168.0.1 reachable internally. www.vhost.com resolves to 123.45.67.89 while vhost1.vhost.com to 192.168.0.1.

If you don't have a huge internal network, you should use hosts file to resolve internal network and don't mix it up with external network.

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationApache Development > Apache Virtual Hosts and Firewall


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT