Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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 shellinabox running on a subdomain through HTTPS and using HTTP Basic Access Authentication using the vhosts file below:

<VirtualHost xx.xx.xx.xx:80>
        Redirect                301 /
        CustomLog               ${APACHE_LOG_DIR}/access.log combined
        ErrorLog                ${APACHE_LOG_DIR}/error.log

<VirtualHost xx.xx.xx.xx:443>
        SSLEngine               On
        SSLCertificateFile      /etc/apache2/ssl/
        SSLCertificateKeyFile   /etc/apache2/ssl/
        SSLCertificateChainFile /etc/apache2/ssl/
        SSLCACertificateFile    /etc/apache2/ssl/ca.pem
        SetEnvIf                User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
        ProxyRequests           Off
        ProxyPass               / http://localhost:4200/
        ProxyPassReverse        / http://localhost:4200/
        <Location />
                AuthUserFile    /etc/apache2/.htpasswd-secure
                AuthName        "Go Away!"
                AuthType        Basic
                Require         valid-user
                Order           Deny,Allow
                Allow           from all
        SetEnvIf                Request_URI "^/u" dontlog
        HostnameLookups         Double
        CustomLog               ${APACHE_LOG_DIR}/ssl_request.log "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
        ErrorLog                ${APACHE_LOG_DIR}/error.log

I currently have another site on another subdomain, using this vhosts file:

<VirtualHost xx.xx.xx.xx:80>
        DocumentRoot            /var/www/

        CustomLog               ${APACHE_LOG_DIR}/access.log combined
        ErrorLog                ${APACHE_LOG_DIR}/error.log

I would prefer to have the second site available at instead of

The main reason for this is so that I can use the same SSL certificate, but there are other reasons as well.

How do I move the second site to be a subdirectory of the first site?

share|improve this question
up vote 4 down vote accepted

Exempt /files from the proxying:

ProxyPass /files !

Put it above the root's ProxyPass. Looks like you'll also need to adjust your DocumentRoots or file structure as needed to serve the content from the SSL vhost.

An example configuration:

<Proxy *>
        Order deny,allow
        Allow from all

ProxyRequests           Off
ProxyPreserveHost       On
<Location "/">
        ProxyPass               http://localhost:8080/
<Location "/files">
        ProxyPass               !
share|improve this answer
What should I make the DocumentRoot, now that the site within /files/ is not at the root? What needs to run is – paradroid Sep 9 '11 at 19:25
If you want to keep the host in place, then just point at that location in the directory structure; Alias /files /var/www/ Your authentication config from <Location /> will still be applying, too; if that's not desired then undo that config in a <Location /files> block. – Shane Madden Sep 9 '11 at 19:29
I have already moved the site's files to /var/www/, which I prefer. How should I set a DocumentRoot for Thanks. – paradroid Sep 9 '11 at 19:33
DocumentRoot /var/www/ should do the trick. – Shane Madden Sep 9 '11 at 19:34
Thanks, that worked. – paradroid Sep 9 '11 at 19:40

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.