phpmyadmin + LEMP Server on Ubuntu 12.04 (Precise Pangolin)


I am running a LEMP server on my linode, set up according to the walkthrough ( … e-pangolin"> )

I currently have several sites running and I want a gui to manage mySQL. I've begun to install phpmyadmin (using … 04-precise"> as a reference). When I run

sudo apt-get install phpmyadmin

I am asked which server to automatically configure phpMyAdmin for but nginx is not an option - my two options are "apache2" and "lightlpd" (I'm thinking I have these installed from some initial tinkering I did while finding a suitable web server configuration.) I am running all of my websites + databases on nginx so I am confused why "nginx" doesn't appear in the phpmyadmin configuration option.

Does anyone have a reliable set of instructions for installing phpmyadmin on a LEMP server that has several active databases?

I definitely don't want to muck up my server or lose database information.

2 Replies

You can just download phpmyadmin from the site, create a vhost for it in nginx manually and upload the files there. There's no need to do it through apt-get.

I'd recommend doing phpmyadmin via apt-get from a security point of view/ease of management. You just need to do the server configuration yourself which is not hard. I'd even do the apache2 configuration myself… Everyone in the world having the default configuration, and therefore default location for phpmyadmin is a bit of a risk.

In nginx it's simple, something like this is a good starting point (from

    server {
        listen          81;
        server_name     localhost;
        root        /usr/share/phpmyadmin;
        index       index.php index.html index.htm;
        if (!-e $request_filename) {
            rewrite ^/(.+)$ /index.php?url=$1 last;
        location ~ .php$ {
            try_files $uri =404;
            fastcgi_pass unix:/var/run/php5-fpm.sock;
            fastcgi_index index.php;
            include /etc/nginx/fastcgi_params;

Don't just copy and paste that code, I'm assuming you know a little bit about about nginx/php-fpm etc. You'll need to adjust the lines appropriately to your needs and I'd suggest adding additional levels of security (ip address allow/deny at a min).


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct