How to install phpMyAdmin on Nginx?

May 5, 2014 8.3k views
After I install phpmyadmin with "sudo apt-get install phpmyadmin", how do I set the server block in nginx configuration?
6 Answers
There's a tutorial for getting a LEMP stack up and running:

https://www.digitalocean.com/community/articles/how-to-install-linux-nginx-mysql-php-lemp-stack-on-ubuntu-12-04

In that tutorial, you'll get MySql and php set up to work with Nginx. There's also a quick tutorial on getting phpMyAdmin working with the LEMP stack here:

https://www.digitalocean.com/community/articles/how-to-install-phpmyadmin-on-a-lemp-server/
by Etel Sverdlov
LEMP stack is a group of open source software to get web servers up and running. The acronym stands for Linux, nginx (pronounced Engine x), MySQL, and PHP. This tutorial explains how to install the required repos to download nginx and php-fpm, how to install MySQL, how to install nginx, how to install php-fpm, how to configure php and nginx, and how to create a php info page. This tutorial is written for Ubuntu 12.04.
Thank you for the reply, the condition is not as simple as the tutorial.

While I type in "sudo ln -s /usr/share/phpmyadmin/ /usr/share/nginx/www",
I get the error as,

ln: failed to create symbolic link '/usr/share/nginx/www/phpmyadmin': File exists

How can I fix it?

It sounds like you already did it. What's the output of:


ls /usr/share/nginx/www/phpmyadmin


Have you tried to access http://your.ip.address/phpmyadmin ?
Thanks for the hint, but there is no luck.
"ls /usr/share/nginx/www/phpmyadmin" got lots of files listed.

When I enter http://my_ip/phpmyadmin

The error message shows up as,

404 Not Found

There must be something wrong. Should I set up something else?
This assumes that you have "/usr/share/nginx/www/" set as the root directory for your Nginx server block. The file "/etc/nginx/sites-enabled/default" should have a section that looks like:


server {
listen 80;

root /usr/share/nginx/www;


On newer version of Ubuntu the root might be "/usr/share/nginx/html" In that case you'd need to link phpmyadmin there instead.

Could you pastebin your Nginx configuration?
by Etel Sverdlov
LEMP stack is a group of open source software to get web servers up and running. The acronym stands for Linux, nginx (pronounced Engine x), MySQL, and PHP. This tutorial explains how to install the required repos to download nginx and php-fpm, how to install MySQL, how to install nginx, how to install php-fpm, how to configure php and nginx, and how to create a php info page. This tutorial is written for Ubuntu 12.04.
Have another answer? Share your knowledge.