You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Jeffrey T. Sims" <jt...@comcast.net> on 2004/02/06 20:52:06 UTC
[users@httpd] Multiple Domains on one web server - no external access
I'm hosting multiple registered domains on one OpenBSD 3.4 server running
Apache 1.3.28. I also run DNS on this machine. The box has one NIC with a
static IP (10.2.1.8) and aliases for each additional domain (10.2.1.#). On
the internal network, all domains properly resolve and show the appropriate
index page for that domain; however, external users can't access the proper
index page. Everything rolls to the default domain (domain1.com). All
in-bound http traffic is directed by the router to the DNS/Web server
(10.2.1.8).
I find my results very strange after browsing the list for similar issues.
The other postings seem to have the reverse condition - external users can
hit each domain index page, but internal users can't. I am perplexed!
My configuration is as follows:
Cable Modem
|
|
D-Link Router(DI-624 running NAT - IP 10.2.1.1 with
| open ports 22, 25, 53, 80, 110, 443)
|
D-Link Switch
|
|
|---------------------------|-------------> other computers on the
internal network
(Web Server) W2K machine
10.2.1.8 - domain1.com
10.2.1.# - domain2.com
10.2.1.# - domain3.com
Here are a series of snippets from my httpd.conf that configure the
VirtualHost Section -
### Section 3: Virtual Hosts
# www.domain2.com and www.domain3.com
NameVirtualHost 10.2.1.9:80
NameVirtualHost 10.2.1.10:80
#
<VirtualHost 10.2.1.9:80>
ServerName www.domain2.com
ServerAdmin webmaster@domain2.com
DocumentRoot "/var/www/www.domain2.com"
DirectoryIndex index.html
ServerAlias domain2.com
ServerAlias 10.2.1.9:80
ErrorLog logs/www.domain2.com-error_log
CustomLog logs/www.domain2.com-access_log common
</VirtualHost>
#
<VirtualHost 10.2.1.10:80>
ServerName www.domain3.com
ServerAdmin webmaster@domain3.com
DocumentRoot "/var/www/www.domain3.com"
DirectoryIndex index.html
ServerAlias domain3.com
ServerAlias 10.2.1.9:80
ErrorLog logs/www.domain3.com-error_log
CustomLog logs/www.domain3.com-access_log common
</VirtualHost>
I've considered moving my OpenBSD in front of the RouterAny suggestions that
will help me resolve this issue would be appreciated.
Jeff
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
RE: [users@httpd] Multiple Domains on one web server - no external access
Posted by "Jeffrey T. Sims" <jt...@comcast.net>.
Brian -
This worked perfectly. I didn't realize that I was mixing Named-based
versus IP-based vhosting formats. Thanks for your assistance.
-----Original Message-----
From: Brian Dessent [mailto:brian@dessent.net]
Sent: Friday, February 06, 2004 3:29 PM
To: users@httpd.apache.org
Subject: Re: [users@httpd] Multiple Domains on one web server - no
external access
"Jeffrey T. Sims" wrote:
> I'm hosting multiple registered domains on one OpenBSD 3.4 server running
> Apache 1.3.28. I also run DNS on this machine. The box has one NIC with
a
> static IP (10.2.1.8) and aliases for each additional domain (10.2.1.#).
On
> the internal network, all domains properly resolve and show the
appropriate
> index page for that domain; however, external users can't access the
proper
> index page. Everything rolls to the default domain (domain1.com). All
> in-bound http traffic is directed by the router to the DNS/Web server
> (10.2.1.8).
>
> I find my results very strange after browsing the list for similar issues.
> The other postings seem to have the reverse condition - external users can
> hit each domain index page, but internal users can't. I am perplexed!
It looks like you're trying to do both IP-based and Name-based virtual
hosting with the same setup. In other words, external users are going
to be coming in on the same IP:port combination and differentiating the
site based on the "Host:" header. Your internal LAN peers are going to
be differentiating the different sites by IP address however.
You should settle on one or the other -- either have each vhost on its
own IP address, or have them on the same IP address but each with a
different ServerName. If you have only one external IP address, you
need to do name-based vhosting, unless you want each server on a
different port (and there's really no reason why you should want that.)
I suggest that you just go with pure name-based virtual hosting. Give
your web server a single IP address of 10.2.1.8. In your firewall,
forward all port 80 traffic to that machine In your local DNS server,
configure all your hosted domain names to resolve to the 10.2.1.8
address. In the real DNS that the domains point to, have all those
domain names point to the same external IP address. Then have something
such as:
NameVirtualHost 10.2.1.8:80
<VirtualHost 10.2.1.8>
ServerName www.domain1.com
# anything that applies to domain1 here
</VirtualHost>
<VirtualHost 10.2.1.8>
ServerName www.domain2.com
# anything that applies to domain2 here
</VirtualHost>
<VirtualHost 10.2.1.8>
ServerName www.domain3.com
# anything that applies to domain3 here
</VirtualHost>
In other words, if your servers are differentiated by IP address, then
it's not going to work right when all the external requests come in on
the same IP address. For that you'd need to do name-based vhosting
across the board.
Brian
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Multiple Domains on one web server - no external
access
Posted by Brian Dessent <br...@dessent.net>.
"Jeffrey T. Sims" wrote:
> I'm hosting multiple registered domains on one OpenBSD 3.4 server running
> Apache 1.3.28. I also run DNS on this machine. The box has one NIC with a
> static IP (10.2.1.8) and aliases for each additional domain (10.2.1.#). On
> the internal network, all domains properly resolve and show the appropriate
> index page for that domain; however, external users can't access the proper
> index page. Everything rolls to the default domain (domain1.com). All
> in-bound http traffic is directed by the router to the DNS/Web server
> (10.2.1.8).
>
> I find my results very strange after browsing the list for similar issues.
> The other postings seem to have the reverse condition - external users can
> hit each domain index page, but internal users can't. I am perplexed!
It looks like you're trying to do both IP-based and Name-based virtual
hosting with the same setup. In other words, external users are going
to be coming in on the same IP:port combination and differentiating the
site based on the "Host:" header. Your internal LAN peers are going to
be differentiating the different sites by IP address however.
You should settle on one or the other -- either have each vhost on its
own IP address, or have them on the same IP address but each with a
different ServerName. If you have only one external IP address, you
need to do name-based vhosting, unless you want each server on a
different port (and there's really no reason why you should want that.)
I suggest that you just go with pure name-based virtual hosting. Give
your web server a single IP address of 10.2.1.8. In your firewall,
forward all port 80 traffic to that machine In your local DNS server,
configure all your hosted domain names to resolve to the 10.2.1.8
address. In the real DNS that the domains point to, have all those
domain names point to the same external IP address. Then have something
such as:
NameVirtualHost 10.2.1.8:80
<VirtualHost 10.2.1.8>
ServerName www.domain1.com
# anything that applies to domain1 here
</VirtualHost>
<VirtualHost 10.2.1.8>
ServerName www.domain2.com
# anything that applies to domain2 here
</VirtualHost>
<VirtualHost 10.2.1.8>
ServerName www.domain3.com
# anything that applies to domain3 here
</VirtualHost>
In other words, if your servers are differentiated by IP address, then
it's not going to work right when all the external requests come in on
the same IP address. For that you'd need to do name-based vhosting
across the board.
Brian
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org