Apache Alias subfolder and starting with dot

Posted by MauricioOtta on Server Fault See other posts from Server Fault or by MauricioOtta
Published on 2013-10-23T06:58:51Z Indexed on 2013/10/23 10:00 UTC
Read the original article Hit count: 307

Filed under:
|
|

I have a multi purpose server running ArchLinux that currently serves multiple virtual hosts from /var/www/domains/EXAMPLE.COM/html /var/www/domains/EXAMPLE2.COM/html

I deploy those websites (mostly using Kohana framework) using a Jenkins job by checking out the project, removes the .git folder and ssh-copy the tar.gz to /var/www/domains/ on the server and untars it.

Since I don't want to have to re-install phpMyAdmin after each deploy, I decided to use an alias.

I would like the alias to be something like /.tools/phpMyAdmin/ so I could have more "tools" later if I wanted to.

I have tried just changing the default httpd-phpmyadmin.conf that was installed by following the official WIKI: https://wiki.archlinux.org/index.php/Phpmyadmin

Alias /.tools/phpMyAdmin/ "/usr/share/webapps/phpMyAdmin"
<Directory "/usr/share/webapps/phpMyAdmin">
        AllowOverride All
        Options FollowSymlinks
        Order allow,deny
        Allow from all
        php_admin_value open_basedir "/var/www/:/tmp/:/usr/share/webapps/:/etc/webapps:/usr/share/pear/"
</Directory>

Changing only that, doesn't seem to work with my current setup on the server, and apache forwards the request to the framework which 404s (as there's no route to handle /.tools/phpAdmin).

I have Mass Virtual hosting enable and setup like this:

#
# Use name-based virtual hosting.
#
NameVirtualHost *:8000

# get the server name from the Host: header
UseCanonicalName On

# splittable logs
LogFormat "%{Host}i %h %l %u %t \"%r\" %s %b" vcommon
CustomLog logs/access_log vcommon

<Directory /var/www/domains>
# ExecCGI is needed here because we can't force
# CGI execution in the way that ScriptAlias does
    Options FollowSymLinks ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

RewriteEngine On

# a ServerName derived from a Host: header may be any case at all
RewriteMap lowercase int:tolower

## deal with normal documents first:
# allow Alias /icons/ to work - repeat for other aliases
RewriteCond %{REQUEST_URI} !^/icons/
# allow CGIs to work
RewriteCond %{REQUEST_URI} !^/cgi-bin/
# do the magic
RewriteCond %{SERVER_NAME}  ^(www\.|)(.*)
RewriteRule ^/(.*)$ /var/www/domains/${lowercase:%2}/html/$1
## and now deal with CGIs - we have to force a MIME type
RewriteCond %{REQUEST_URI} ^/cgi-bin/
RewriteRule ^/(.*)$ /var/www/domains/${lowercase:%{SERVER_NAME}}/cgi-bin/$1 [T=application/x-httpd-cgi]

There is also nginx running on this server on port 80 as a reverse proxy for Apache:

    location ~ \.php$ {
        proxy_pass   http://127.0.0.1:8000;
    }

Everything else was setup by following the official WIKI so I don't think those would cause trouble. Do I need to have the alias for phpMyAdmin setup along the mass virtual hosting or can it be in a separate include file for that alias to work?

© Server Fault or respective owner

Related posts about apache2

Related posts about phpmyadmin