Question

How to install phpMyAdmin on Nginx?

  • Posted May 5, 2014

After I install phpmyadmin with “sudo apt-get install phpmyadmin”, how do I set the server block in nginx configuration?

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

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: <br> <br><pre> <br>server { <br> listen 80; <br> <br> root /usr/share/nginx/www; <br></pre> <br> <br>On newer version of Ubuntu the root might be “/usr/share/nginx/html” In that case you’d need to link phpmyadmin there instead. <br> <br>Could you pastebin your Nginx configuration?

Thanks for the hint, but there is no luck. <br>“ls /usr/share/nginx/www/phpmyadmin” got lots of files listed. <br> <br>When I enter http://my_ip/phpmyadmin <br> <br>The error message shows up as, <br> <br>404 Not Found <br> <br>There must be something wrong. Should I set up something else? <br>

It sounds like you already did it. What’s the output of: <br> <br><pre> <br>ls /usr/share/nginx/www/phpmyadmin <br></pre> <br> <br>Have you tried to access http://your.ip.address/phpmyadmin ?

Thank you for the reply, the condition is not as simple as the tutorial. <br> <br>While I type in “sudo ln -s /usr/share/phpmyadmin/ /usr/share/nginx/www”, <br>I get the error as, <br> <br>ln: failed to create symbolic link ‘/usr/share/nginx/www/phpmyadmin’: File exists <br> <br>How can I fix it? <br> <br>

There’s a tutorial for getting a LEMP stack up and running: <br> <br>https://www.digitalocean.com/community/articles/how-to-install-linux-nginx-mysql-php-lemp-stack-on-ubuntu-12-04 <br> <br>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: <br> <br>https://www.digitalocean.com/community/articles/how-to-install-phpmyadmin-on-a-lemp-server/