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 “www.mysitename.com/phpmyadmin” result in a Rails routing error (404 Not Found.)
I followed the procedure suggested at http://kiran.gnufied.org/2010/12/23/rails-passenger-and-phpmyadmin-issue/ 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
</LocationMatch>
Alias /phpmyadmin “/usr/share/phpmyadmin”
<Directory “/usr/share/phpmyadmin”>
PassengerEnabled off
AllowOverride All
</Directory>
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?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
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:
/etc/apache2/sites-available/testapp.conf:
<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
</Directory>
</VirtualHost>
/etc/apache2/conf-available/phpmyadmin.conf
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/
</IfModule>
</Directory>
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.