l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
October 7: Social gathering
Next Installfest:
TBD
Latest News:
Aug. 18: Discounts to "Velocity" in NY; come to tonight's "Photography" talk
Page last updated:
2004 Apr 11 17:37

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] Apache virtual host config
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] Apache virtual host config



Every host you are going to host on the machine needs its own virtual host 
stanza.  Here is mine for one of my static IP's with multiple virtual hosts;

NameVirtualHost 208.201.241.88:80
NameVirtualHost 208.201.241.88:443
#NameVirtualHost *

<VirtualHost 208.201.241.88:443>
        ServerAdmin webmaster@streetchiro.com
        DocumentRoot /var/www/html
        Servername www.streetchiro.com
</VirtualHost>

<VirtualHost 208.201.241.88:80>
        ServerAdmin webmaster@streetchiro.com
        DocumentRoot /var/www/html
        Servername www.streetchiro.com
</VirtualHost>

<VirtualHost 208.201.241.88:80>
    ServerName rt.streetchiro.com
    DocumentRoot /opt/rt3/share/html
    AddDefaultCharset UTF-8
   # these four lines apply to Apache2+mod_perl2 only: {{{
    PerlSetVar MasonArgsMethod CGI
    PerlModule Apache2 Apache::compat
    RewriteEngine On
    RewriteRule ^(.*)/$ $1/index.html
# }}}

    PerlModule Apache::DBI
    PerlRequire /opt/rt3/bin/webmux.pl

    <Location />
        SetHandler perl-script
        PerlHandler RT::Mason
    </Location>
</VirtualHost>

<VirtualHost 208.201.241.88:80>
    ServerAdmin webmaster@oswizards.com
    DocumentRoot /var/www/oswizards.com
    ServerName www.oswizards.com
    ErrorLog logs/www.oswizards.com-error_log
    CustomLog logs/www.oswizards.com-access_log common
</VirtualHost>

<VirtualHost 208.201.241.88:80>
    ServerAdmin webmaster@oswizards.com
    DocumentRoot /var/www/oswizards.com
    ServerName oswizards.com
    ErrorLog logs/www.oswizards.com-error_log
    CustomLog logs/www.oswizards.com-access_log common
</VirtualHost>

On Sunday 11 April 2004 02:14 pm, Peter Jay Salzman wrote:
> 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

-- 
Mark Street, D.C.
Red Hat Certified Engineer
Cert# 807302251406074
--
Key fingerprint = 3949 39E4 6317 7C3C 023E  2B1F 6FB3 06E7 D109 56C0
GPG key http://www.streetchiro.com/pubkey.asc
_______________________________________________
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech



LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
EDGE Tech Corp.
For donating some give-aways for our meetings.