How do I set separate phpMyAdmin for each Nginx Server Blocks ?

  • Posted October 19, 2014

Hello, I followed these tutorials:

How To Install Linux, nginx, MySQL, PHP (LEMP) stack on Ubuntu 14.04 How To Install and Secure phpMyAdmin with Nginx on an Ubuntu 14.04 Server How To Set Up Nginx Server Blocks (Virtual Hosts) on Ubuntu 14.04 LTS

After I removed the /etc/nginx/sites-enabled/default the /phpMyAdmin URI returned a 404 error on each and every virtualhost. I figured out I had to make a symlink to phpMyAdmin in every virtualhost like this cd /var/www/ && sudo ln -s /usr/share/phpmyadmin phpmyadmin.

Now its working fine, the problem is all virtualhost uses the same phpMyAdmin. I am planning to create a separate virtualhost for my friend to practice, but i don’t want him to be able to modify my databases.

I hope there is an universal solution for this, because at some virtualhost I want to enable mongoDB and nodeJS at some I want to use PHP.


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.

In phpMyadmin, you can create different users, and then give those users privileges on certain databases.

When someone logs in with a user, they will only see the databases they have privileges for.

Your main admin user, of course, will have Global Privileges that include Grant. Everyone else will be limited to the databases they need access to.

The one exception (for my little routine) is, in addition to an admin user, I also create a backup_user who has limited Global privileges. That way I can run a script on a daily schedule that backs up all databases.