[Techtalk] Apache vhosts

Karine Delvare kproot at nerim.net
Tue Aug 9 17:11:16 EST 2005


Hello,

   A security consultant made me use vhosts at work, and left me with an
awesome httpd.conf file, which was pretty great until today.
   He did that on my workstation, which I develop the web app on. At the
time I told him I would need other web apps to run on that box, and he
showed me how to add other vhosts. Here is how it looks so far:

### Revelant parts (or so I think) of httpd.conf
DocumentRoot /home/proot/public_html/
ServerTokens Prod
ServerSignature Off
DirectoryIndex index.php index.html
<Directory />
        AllowOverride None
        Order deny,allow
        Deny from all
</Directory>
include conf/efp.conf
include conf/phpmyadmin.conf
include conf/misc.conf
###

Note 1 : efp is the sensitive web app that will be deployed and which
needed this all, phpmyadmin is what it says it is, misc is a directory in
which I put other web apps (I was tired of making one more vhost for each
app)
Note 2 : DirectoryIndex was only set to index.php before, but some of my
misc apps need pure html and I added that - is it possible to add it only
in the vhost?

### efp.conf
NameVirtualHost 192.168.102.147:80
Listen 192.168.102.147:80
<VirtualHost 192.168.102.147:80>
        SSLEngine On
        SSLCertificateFile     /home/proot/public_html/efp/ssl/server.pem
        SSLCertificateKeyFile  /home/proot/public_html/efp/ssl/server.key
        SSLCACertificateFile   /home/proot/public_html/efp/ssl/ca.pem

        SSLVerifyClient none
        SSLOptions +StdEnvVars

        #ServerName efp.V0153.fr
        ServerName 192.168.102.147

        DocumentRoot /home/proot/public_html/efp/htdocs/

        ErrorLog /var/log/apache2/Apache2-efp-error.log
        CustomLog /var/log/apache2/Apache2-efp-access.log combined
        LogLevel warn

        <Directory /home/proot/public_html/efp/htdocs/>
                AllowOverride none
                Order allow,deny
                Allow from all
        </Directory>

        Alias /images/ /home/proot/public_html/efp/images/
        <Directory /home/proot/public_html/efp/images/>
                AllowOverride none
                Order allow,deny
                Allow from all
        </Directory>
</VirtualHost>
###

### misc.conf (phpmyadmin.conf is very similar to that one,
### with ServerName phpmyadmin.V0153.fr)
NameVirtualHost 192.168.102.147:80
<VirtualHost 192.168.102.147:80>
        ServerName misc.V0153.fr
        DocumentRoot /home/proot/public_html/misc/

        ErrorLog /var/log/apache2/Apache2-misc-error.log
        CustomLog /var/log/apache2/Apache2-misc-access.log combined
        LogLevel warn

        <Directory /home/proot/public_html/misc/>
                AllowOverride all
                Order allow,deny
                Allow from all
        </Directory>
</VirtualHost>
###

### /etc/hosts contains:
192.168.102.147 phpmyadmin.V0153.fr
192.168.102.147 misc.V0153.fr
### so I can browse my own apps easily with eg http://misc.V0153.fr/

So what happened today? I need to let other people at work look at one of
the web apps I develop in misc. So far they already looked at the 'efp'
webapp by browsing the url http://192.168.102.147/, but now they would
need a hosts file too if they would want to look at my misc apps. They are
all running Windows and I saw the hosts file location is dependant on your
Win version, and you probably need admin rights to edit it - I'd like to
avoid that if that's possible.

I was hoping I could modify my misc.conf in some way, so they could browse
http://192.168.102.147/misc/ and see all the misc apps there. This may be
very easy to do... but I'm lost with vhosts!

Thanks for any tip/advice,
   Karine



More information about the Techtalk mailing list