Installing PhpMyAdmin on Ubuntu 16.04 LEMP

Posted October 6, 2017 9.5k views
LEMPUbuntu 16.04

I’m trying to install phpMyAdmin by SSH on Ubuntu 16.04 with LEMP..
I’m stopped on this string:

sudo ln -s /usr/share/phpmyadmin /usr/share/nginx/html

They take to me this error:

ln: failed to create symbolic link '/usr/share/ngix/html': No such file or directory

I’ve watched by FTP and the folders exist..!
Why take to me this error?

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.

Submit an Answer
1 answer

Solved adding this on nginx configuration:

location /phpmyadmin {
  root /usr/share/;
  index index.php;
  try_files $uri $uri/ =404;

  location ~ ^/phpmyadmin/(doc|sql|setup)/ {
    deny all;

  location ~ /phpmyadmin/(.+\.php)$ {
    fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
    include snippets/fastcgi-php.conf;
  • Thanks so much for posting your solution! I could not get phpmyadmin to load. I made the change as you did and now it works.

    One note: The author said he added the above code to “nginx configuration”. To clarify, that would be the website config file for the website, which resides in etc/nginx/sites-available. In my case, the file name is “default” since I only run one site on the server and it resides in the webserver root.

    The “nginx configuration” file actually resides in etc/nginx and is named ”nginx.conf”. You would not put the above code in that. Include it instead in the config file for the site. In the case of multiple sites, add it to the config file of each site. This way you can control whether you want phpmyadmin available for a site or not. On sites where you don’t want it available, simply don’t add the code to the site config file.