Squeezebox Setup

Allowing network access to PHPMyAdmin

PhpMyAdmin is a web tool for administering (and browsing) mysql based databases. Its extremely useful, and we installed it when we put php on (if you didn’t then yum --enablerepo=remi install phpmyadmin will do it), but the default configuration is to only allow access from localhost – which is not so useful on a NAS. So lets open that up so that the local subnet can use it.  First edit the file /etc/httpd/conf.d/phpMyAdmin.conf and add the additional line to the directory settings:

<Directory /usr/share/phpMyAdmin/>
    order deny,allow
    deny from all
    allow from 127.0.0.1
    allow from 192.168.1.0/15
</Directory>

If you wanted to allow access to everybody then you could just change it to:

<Directory /usr/share/phpMyAdmin/>
    order allow,deny
    allow from all
</Directory>

A restart (service httpd restart) is enough to pick this up.  One other change that may be worth making is to add rewrite rules to force SSL on this connection.  To do that we need to change the root virtual host config in /etc/httpd/conf/httpd.conf – adding in the two extra rules below:

<VirtualHost *:80>
    DocumentRoot /home/apache
    ServerName yourhost.dyndns.org
    ErrorLog /var/log/httpd/error_log
    CustomLog /var/log/httpd/access_log combined
    RewriteEngine On
    RewriteRule ^/cube/(.*)$ https://mail.yourhost.dyndns.org/$1 [R=301,L]
    RewriteCond %{HTTPS} !=on
    RewriteRule ^/phpmyadmin/(.*)$ https://%{HTTP_HOST}/phpmyadmin/$1 [R,L]
    RewriteRule ^/phpMyAdmin/(.*)$ https://%{HTTP_HOST}/phpmyadmin/$1 [R,L]
</VirtualHost>

After doing another restart (service httpd restart) you should be able to access http://ip address/phpmyadmin to access the database.  The username and password you are prompted for it the database username and password.

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.