vaindil
vaindil

Reputation: 7854

Configuring Alias and Directory inside Apache VirtualHost

I have an existing subdomain, subdomain.mysite.com, that I use with SSL. I'm trying to install PHPasswordPusher on this subdomain, but I'm not sure how to do it correctly with Apache.

I've followed the instructions as provided. For example, the DocumentRoot for subdomain.mysite.com is /var/www/subdomain, and the two pwpusher directories are in /var/www/ppush. I've added the code exactly as given in the installation instructions to the appropriate VirtualHost, and I've edited the code as specified to point to the proper directories for everything. I'm getting a 404, however, when I try to go to the Alias directory on the subdomain. (Yes, I restarted Apache.)

How do I get the given Apache config to work within an existing VirtualHost? The full code for the VirtualHost is below, edited for the locations I've given above.

<VirtualHost *:80 *:443>
        ServerName subdomain.mysite.com

        ServerAdmin [email protected]
        DocumentRoot /var/www/subdomain

        RewriteEngine On
        RewriteCond %{HTTPS} off
        RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

        SSLEngine on
        SSLProtocol all -SSLv3
        SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM

        SSLCertificateFile /path/to/cert.crt
        SSLCertificateKeyFile /path/to/key.key
        SSLCertificateChainFile /path/to/cert2.pem

    ##### PHPasswordPusher #####

        Alias /pwpusher/ /var/www/ppush/pwpusher_public/

        <Directory /var/www/ppush/pwpusher_public/>
            AllowOverride None
            Order allow,deny
            Allow from all
            DirectoryIndex pw.php
        </Directory>

        <Directory /var/www/ppush/pwpusher_private/>
            AllowOverride None
            Order deny,allow
            Deny from all
        </Directory>
</VirtualHost>

Upvotes: 3

Views: 2833

Answers (1)

VolenD
VolenD

Reputation: 3692

Everything with the configuration looks OK, except *:80 for the VirtualHost which would generate "Bad request" error when the URL is opened with http:// (I advise you to move the SSL directives to <VirtualHost *:443>), but would not be the reason for 404 error.

A bit crude, but you can try to understand what directory Apache really accesses by running

strace -p $(pgrep apache2 | xargs | sed 's/ / -p /g')

and open the page. On one of the last lines you should see something like:

stat("/var/www/dsd", 0x7fff470d2400) = -1 ENOENT (No such file or directory)

Upvotes: 1

Related Questions