Blog

Our Insights et. al.

Posted on by Daniel

Configure phpMyAdmin with Nginx

NERD ALERT: I must warn those of you who are not technical. This is full of nerdy and super-cool server admin information.

I’ve decided that I no longer want to have Apache on my servers. I have long since made the switch from Apache to Nginx, but never took the time to convert everyone of my sites, not to mention phpMyAdmin, which comes pre-configured to work with Apache (if you are using a Debian/Ubuntu server at least). At last I decided to take a crack at moving phpMyAdmin to Nginx and ditching Apache forever.

Finding a configuration was fairly simple, but I wanted to have a custom URL as a subdirectory of one of my current domains, all without moving the phpMyAdmin system files. Below is what I came up with:

location /secretdb {
  alias /usr/share/phpmyadmin/;
  try_files $uri $uri/ /index.php;
}
location ~ ^/secretdb(.+\.php)$ {
  alias /usr/share/phpmyadmin$1;
  fastcgi_pass 127.0.0.1:9000;
  fastcgi_index index.php;
  fastcgi_param SCRIPT_FILENAME /usr/share/phpmyadmin$1;
  include fastcgi_params;
}

As you can see, without switching any of my phpMyAdmin directories I was able to use the Nginx `alias` to allow access using a custom URL. I hope this helps someone else, because it took my awhile to get the configuration just right.

Enjoy!

Category: Server Administration | Tags:
Posted on by Daniel

New Website Design & Location

If you are coming from my old site, welcome to O Family Media. This new path of design and development will help both myself and my clients get more out of the web. This new site and domain symbolize a moving into the future of the web; embracing the technology of tomorrow as it were.

Category: Random Thoughts