PhpMyAdmin got 404 not found error on nginx ubuntu 16.04

Hello Digital Oceans, I’m using ubuntu 16.04 and configured LEMP with this tutorial on it. I tried to add phpMyAdmin with this tutorial , but when I tried to access /phpmyadmin route, I got 404 error. here is my default site-available config file:

server {
        listen 80 default_server;
        listen [::]:80 default_server;

        root /var/www/html;

        index index.php index.html index.htm index.nginx-debian.html;

        server_name **My_IP_ADDRESS**;

        location / {
                try_files $uri $uri/ =404;

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

        location ~ /\.ht {
                deny all;

Am i miss something? Thank you, JavaDroid :)

Submit an answer

This textbox defaults to using Markdown to format your answer.

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

Sign In or Sign Up to Answer

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.

Accepted Answer


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

That should produce something that looks like:

lrwxrwxrwx 1 root root   22 Apr  4 14:31 phpmyadmin -> /usr/share/phpmyadmin/

Which means the symlink is valid and should now work when you visit:


Where IP_ADDR is your IP address.

Hello Digital Oceans, I had nginx, phpmyadmin, mysql, php7.2-fpm on a Ubuntu in browser on - “couldn’t find this page”

I can not configure phpmyadmin Help me, what am I doing wrong?

My /etc/nginx/sites-available/default server { listen 80 default_server; listen [::]:80 default_server; root /var/www/html/public; index index.html index.htm index.php; server_name; location / { try_files $uri $uri/ /index.php$is_args$args; } location ~ .php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.2-fpm.sock; } }

My /etc/nginx/nginx.conf

user www-data; error_log /var/log/nginx.error_log info; worker_processes auto; pid /run/;

events { worker_connections 768;


http { ## # Basic Settings ## disable_symlinks off; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; include /etc/nginx/mime.types; default_type application/octet-stream; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE ssl_prefer_server_ciphers on; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; gzip on; gzip_disable “msie6”; include /etc/nginx/conf.d/.conf; include /etc/nginx/sites-enabled/; }

I add link sudo ln -s /usr/share/phpmyadmin/ /var/www/html/phpmyadmin lrwxrwxrwx 1 root root 22 Mar 13 07:38 phpmyadmin -> /usr/share/ph pmyadmin/

Add /etc/nginx/sites-available/default, copy this script in server{ …copy here… } location /phpmyadmin { root /usr/share/; index index.php index.html index.htm; location ~ ^/phpmyadmin/(.+.php)$ { try_files $uri =404; root /usr/share/; fastcgi_pass; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include /etc/nginx/fastcgi_params; } location ~* ^/phpmyadmin/(.+.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ { root /usr/share/; } } location /phpMyAdmin { rewrite ^/* /phpmyadmin last; } in browser on 502 Bad Gateway

I had nginx, phpmyadmin, mariadb, php-fpm on a centos 7. now i just update php5 to php7. and phpmyadmin is not found. so i followed all your steps.even restart nginx, php-fpm. ls -l showing phpmyadmin in my server location directory. but in browser its showing 404. its chown by root:root and chmod 777. phpmyadmin -> /usr/share/phpmyadmin. i know upgrading to php7 uninstall old one, so i download and properly extract phpmyadmin in /usr/share/ directory. no error log found in php/nginx error log files. any idea??

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel