Can't Connect to phpMyadmin On Ubuntu 16.04 / Nginx / HTTPS

Posted May 31, 2016 25k views
Linux BasicsNginxMySQLGetting StartedLEMPLinux Commands

Hello Digital Oceans,
May i know why i can’t access my phpmyadmin on Nginx and Ubuntu 16.04?
I have following all of the tutorial, but the page can’t be reach.

server {
listen 80;
listen [::]:80;
root /var/www/xyz/html;
return 301 https://$server_name$request_uri;

# SSL configuration
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
include snippets/;
include snippets/ssl-params.conf;

root /var/www/xyz/html;
index index.php index.html index.htm index.nginx-debian.html;


location ~ /.well-known {
allow all;

location = /favicon.ico { log_not_found off; access_log off; }
location = /robots.txt { log_not_found off; access_log off; allow all; }
location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
expires max;
log_not_found off;

location / {
#try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php$is_args$args;

location ~ \.php$ {
include snippets/fastcgi-php.conf;
# # With php7.0-cgi alone:
# fastcgi_pass;
# # With php7.0-fpm:
fastcgi_pass unix:/run/php/php7.0-fpm.sock;

location ~ /\.ht {
deny all;

Am i miss something?

Thank you,
Frans W

edited by etel

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
4 answers

I was able to get it worked by making minor change in symlink part as following:

sudo ln -s /usr/share/phpmyadmin /var/www/html

I have the same problem. To install phpmyadmin, I followed this tutorial:

The install seemed to work.
I restarted PHP as follows: sudo service php7.0-fpm restart
I also restarted nginx as follows: sudo systemctl restart nginx

When I browse to, my WP site show a 404 page.

Any idea how can I resolve this issue?

by Justin Ellingwood
Administering relational databases from the command line can be a daunting proposition for many people. A project called phpMyAdmin aims to alleviate this issue by providing an easy to use web interface for MySQL. In this guide, we'll discuss how to install and secure phpMyAdmin on top of a LEMP (Linux, Nginx, MySQL, and PHP) stack on an Ubuntu 14.04 server.

I opened up a support ticket for installing phpMyAdmin on my Ubuntu 16.04 LEMP configuration. I got a response and I am trying to make it work now. Once it is fully functional, I will leave a post here on how I got it working.

The symlink created in that guide points to /usr/share/nginx/www while your root directive points to another directory. Unless you specify another location block, NGINX doesn’t technically know that the directory exists, and doesn’t know where to route the incoming request.

First, remove the symlink you just created by running:

rm -rf /usr/share/nginx/www
That won’t delete phpMyAdmin, it’ll just delete the symlink. Now we’ll create a new one using:

sudo ln -s /usr/share/phpmyadmin/ /var/www/html/phpmyadmin
Since you’ve set root to /var/www/html, that’s your “home” directory or root path that your server block uses. What the above command does is create a symlink from where the phpMyAdmin files are to your root directory.

Once the new symlink is there, you should be able confirm that by running:

ls -al /var/www/html

Whole detail can be found here!