[vox-tech] Apache virtual host config
Peter Jay Salzman
vox-tech@lists.lugod.org
Sun, 11 Apr 2004 14:14:34 -0700
Lewis, thanks.
I kept looking at this. I liked the fact that you used two virtual
hosts. Previously, dirac.org was "global", and liberal.ws was a virtual
host. I changed my configuration to look more like yours.
Still, it wouldn't work.
but then i noticed your IP address. You obviously have DSL or cable and
have a machine performing masquerading as well as firewalling. You used
your internal IP address.
I was using my external IP address.
I changed to:
NameVirtualHost 192.168.0.200
<VirtualHost 192.168.0.200>
ServerAdmin p@dirac.org
DocumentRoot "/www/p/linux"
ServerName www.liberal.ws
ServerAlias liberal.ws
ErrorLog /var/log/apache/test_error
LogLevel warn
CustomLog /var/log/apache/test_access common
</VirtualHost>
<VirtualHost 192.168.0.200>
ServerAdmin p@dirac.org
DocumentRoot "/www"
ServerName www.dirac.org
ServerAlias dirac.org
ErrorLog /var/log/apache/error.log
LogLevel warn
CustomLog /var/log/apache/access.log combined
</VirtualHost>
and everything works as it should work. Note that there were two
problems:
1. NameVirtualHost wants to be the internal IP address.
2. In <VirtualHost X>, X wants to be the internal IP address. Hostname
didn't work correctly. External IP address didn't work correctly.
In hindsight, it only makes sense that apache cares about the internal
IP address, since that's the "real" address of the machine in question.
The external IP is only known by the router/firewall.
Lewis, thanks. I've definitely learned something in the process...
Pete
On Sun 11 Apr 04, 9:19 AM, Lewis Perdue <lperdue@ideaworx.com> said:
> make sure apache is configured for NAME-BASED virtual hosting, NOT
> IP-BASED ...
>
> make sure you have the _true_ document directory as opposed to virtual ...
> pwd will not always show that
>
> If your documents are relying on symbolic links, make sure the server
> allows them
>
> Below are a few lines from the httpd.conf file off the RH9/Apache2 server
> we run off the LAN at home. They may help you. our IP's are all local
> beause they are behind the router.
>
> #
> # Use name-based virtual hosting.
> #
> NameVirtualHost 192.168.1.1
>
> <VirtualHost 192.168.1.1>
> ServerAdmin william@williamperdue.com
> DocumentRoot "/home/lperdue/public_html/perdueweb"
> ServerName www.perdueweb.com
> ServerAlias perdueweb.com
> ErrorLog logs/perdueweb-error_log
> TransferLog logs/perdueweb-error_log
> </VirtualHost>
>
> <VirtualHost 192.168.1.1>
> ServerAdmin william@williamperdue.com
> DocumentRoot "/home/lperdue/public_html/katherineperdue"
> ServerName www.katherineperdue.com
> ServerAlias katherineperdue.com
> ErrorLog logs/katherineperdue-error_log
> TransferLog logs/katherineperdue-error_log
> </VirtualHost>
>
> #
> #
> # DirectoryIndex: sets the file that Apache will serve if a directory
> # is requested.
> #
> # The index.html.var file (a type-map) is used to deliver content-
> # negotiated documents. The MultiViews Option can be used for the
> # same purpose, but it is much slower.
> #
> DirectoryIndex index.html index.html.var
--
Make everything as simple as possible, but no simpler. -- Albert Einstein
GPG Instructions: http://www.dirac.org/linux/gpg
GPG Fingerprint: B9F1 6CF3 47C4 7CD8 D33E 70A9 A3B9 1945 67EA 951D