Setting up alias and directory inside Apache VirtualHost
I have an existing subdomain, subdomain.mysite.com, which I am using with SSL. I'm trying to install PHPasswordPusher on this subdomain, but I'm not sure how to do it with Apache.
I followed the instructions. For example, the DocumentRoot for subdomain.mysite.com matters /var/www/subdomain
, and the two pwpusher directories are in /var/www/ppush
. I added the code as indicated in the installation instructions to the corresponding VirtualHost, and I edited the code as indicated to point to the correct directories for everything. However, I get a 404 when I try to navigate to the Alias directory on a subdomain. (Yes, I restarted Apache.)
How do I get a given Apache configurator to work in an existing VirtualHost? The complete code for VirtualHost is below, edited for the locations above.
<VirtualHost *:80 *:443>
ServerName subdomain.mysite.com
ServerAdmin emailaddress@host.com
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>
source to share
Everything with configuration looks OK except *:80
for VirtualHost
, which generates a Bad Request error when the URL is opened with http://
(I advise you to move the SSL directives to <VirtualHost *:443>
), but will not cause a 404 error.
A bit rough, but you can try to figure out which directory Apache is actually accessing 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)
source to share