Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have following configuration file on my Debian machine:

<VirtualHost *:80>
    ServerAdmin me@domain.tld

    VirtualDocumentRoot /var/workspace/www/%2_%3/%1

    <Directory />
            Options FollowSymLinks
            AllowOverride None

    <Directory /var/workspace/www/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all

    ErrorLog ${APACHE_LOG_DIR}/error.log

    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

Which is great for automation - i just create a directory in specific path and domain just start working.

But sometimes I need to launch apps, which has docroots somewhere else (typicaly www dir or something else), how do I specify this VirtualHosts and keep working the old automatic VirtualHosts?

When I add e.g. this:

<VirtualHost *:80>
  DocumentRoot /var/workspace/www/phabricator_com/www/webroot

  RewriteEngine on
  RewriteRule ^/rsrc/(.*)     -                       [L,QSA]
  RewriteRule ^/favicon.ico   -                       [L,QSA]
  RewriteRule ^(.*)$          /index.php?__path__=$1  [L,QSA]

  SetEnv PHABRICATOR_ENV custom/socialbakers

It routes all requests on /var/workspace/www/phabricator_com/www/webroot and ignores the other vhosts (mentioned above).


share|improve this question

Be sure to have enabled the directive to allow named virtual hosts. I mean:

NameVirtualHost *:80

... in your /etc/httpd/conf/httpd.conf file.

share|improve this answer
When I add specifically NameVirtualHost, it says: [warn] NameVirtualHost *:80 has no VirtualHosts . So if I change the basic VirtualHost from to *:80, it still routes all requests to the first one ( – Radek Simko Mar 5 '12 at 20:46

Are you sure you have provided the proper name after ServerName? I mean, it ends with .local; is it what the HTTP request Host header contains? If there Host header in the HTTP request doesn't match any of the name-based vhosts (or if the request has no Host header), the first vhost will be used.

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.