How do I configure phpMyAdmin to work with Passenger, Rails and Apache2 on Ubuntu 14.04?

I followed the tutorials “How to Install Rails, Apache, and MySQL on Ubuntu with Passenger” and “How to Install and Secure phpMyAdmin on Ubuntu 14.04” but attempts to access phpMyAdmin via “” result in a Rails routing error (404 Not Found.)

I followed the procedure suggested at to disable passenger while attempting to access phpMyAdmin by adding the following to my site’s apache2 config file (at /etc/sites-available/mysitename.conf):

<LocationMatch “^/phpmyadmin/.+”>
    PassengerEnabled off
    AllowOverride All
Alias /phpmyadmin “/usr/share/phpmyadmin”
<Directory “/usr/share/phpmyadmin”>
    PassengerEnabled off
    AllowOverride All

but this results in a 403 Forbidden error.

Does anyone know if this is the proper procedure to enable phpMyAdmin to work on a Rails site and if so how to get around the 403 error?


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

The solution to this is so obvious that I am embarrassed that it took me two days to figure it out! When the Rails portion of the site is active then Passenger needs to be active, but when the phpMyAdmin is accessed then Passenger needs to be disabled. The code snippet above attempts to disable passenger when phpMyAdmin is in the path, but the disabling should really occur in phpMyAdmin’s configuration file and the re-enabling should be in my Rails testapp configuration file as shown below:


<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /home/dev/testapp/public
        RailsEnv development
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
        <Directory "/home/dev/testapp/public">
            PassengerEnabled on
            Options FollowSymLinks
            AllowOverride none
            Require all granted


Alias /phpmyadmin /usr/share/phpmyadmin
<Directory /usr/share/phpmyadmin>
        Options FollowSymLinks
        DirectoryIndex index.php
        PassengerEnabled off
        <IfModule mod_php5.c>
                AddType application/x-httpd-php .php
                php_flag magic_quotes_gpc Off
                php_flag track_vars On
                php_flag register_globals Off
                php_admin_flag allow_url_fopen Off
                php_value include_path .
                php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
                php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/php-gettext/:/usr/share/javascript/