Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I use mod_vhost_alias because it is really easy for me to add new vhost (I just need to create a directory).


UseCanonicalName Off
VirtualDocumentRoot /var/www/%0/htdocs


<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all

However I need to configure a custom vhost to make use of mod_proxy, so I created:


<VirtualHost *>
    ProxyPreserveHost On
    ProxyRequests Off
    <Proxy *>
        Order deny,allow
        Allow from all
    ProxyPass /
    ProxyPassReverse /
    <Location />
        Order allow,deny
        Allow from all

While it is working correctly for the vhost_alias configuration, when I try to request I got a 404 (because the hostname directory doesn't exist), and well my site is correctly enabled.

Any ideas?

share|improve this question
Create (empty) hostname directory? – Lazy Badger Mar 14 '12 at 23:00

1 Answer 1

up vote 0 down vote accepted

Move your VirtualDocumentRoot /var/www/%0/htdocs directive out of /etc/apache2/mods-available/vhost_alias.conf, and into the <VirtualHost> block in /etc/apache2/sites-available/default; you don't want it applying to everything.

Also - change your vhost definition in /etc/apache2/sites-available/mysite from:

<VirtualHost *>


<VirtualHost *:80>

.. and make sure you have a NameVirtualHost *:80 directive somewhere (ports.conf?), so that your second vhost actually gets requests.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.