Question

PhpMyAdmin returning 404, Ubuntu 18.04 LEMP Stack

Posted May 9, 2020 5.3k views
PHPLEMP

I have a droplet serving five websites using Nginx reverse proxy. Everything is working fine, however after installing PhpMyAdmin I’m getting a 404 Not Found error. (http://mysite.com/phpmyadmin)

My nginx error log looks like this:

root@lamp-tor1-01:/usr/share# tail -f /var/log/nginx/error.log

2020/05/09 14:20:33 [error] 32547#32547: *57 directory index of “/var/www/” is forbidden, client: 198.84.238.174, server: 165.227.46.52, request: “GET / HTTP/1.1”, host: “165.227.46.52”
165.227.46.52, request: “GET /phpmyadmin HTTP/1.1”, host: “165.227.46.52”
2020/05/09 14:44:34 [error] 32547#32547: *124 open() “/usr/share/phpMyAdmin” failed (2: No such file or directory), client: 198.84.238.174, server: 165.227.46.52, request: “GET /phpmyadmin HTTP/1.1”, host: “165.227.46.52”
2020/05/09 14:46:37 [error] 32547#32547: *129 open() “/usr/share/phpMyAdmin”

My /etc/nginx/sites-available/default Server Block is as follows:

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

        root /var/www;

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

        server_name 165.227.46.52;

        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;
        }
}

My symbolic link looks like this:

lrwxrwxrwx 1 root root 21 May 9 15:01 phpmyadmin -> /usr/share/phpmyadmin

All of my sites are working fine with their domains, however if I try and access my ip i get a 403 forbidden error. Maybe this is related, I don’t know.

I know that this is not a new topic, but I have gone through all examples on this message board, and I’m unable to fix it. I have reset my symbolic link, and I have tried a few different configurations of my default server block. I also contacted customer support, but they are responding every 4 days now, and they just give me a link to a tutorial on how to install PhpMyAdmin, which I’ve obviously tried a few times. Any help would be appreciated.

Thanks!

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.

×
2 answers

Hi @xar86413,

Looking at the log, it seems like the following path or symlink can’t be found “/usr/share/phpMyAdmin” :

2020/05/09 14:44:34 [error] 32547#32547: *124 open() “/usr/share/phpMyAdmin” failed (2: No such file or directory), client: 198.84.238.174, server: 165.227.46.52, request: “GET /phpmyadmin HTTP/1.1”, host: “165.227.46.52”

This is either a permissions issue or the folder is indeed not there. Please do check it out with the following command

/usr/share/phpmyadmin

If it isn’t, I’ll recommend reinstalling the service following this tutorial step by step exactly how it’s written as it seems something was missed during the configuration:

https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-phpmyadmin-with-nginx-on-an-ubuntu-18-04-server#step-2-%E2%80%94-changing-phpmyadmin%E2%80%99s-default-location

Regards,
KDSys

by Erika Heidi
phpMyAdmin was created so that users can interact with MySQL through an intuitive web interface, running alongside a PHP development environment. In this guide, we'll discuss how to install phpMyAdmin on top of an Nginx server, and how to configure the server for increased security.

Just to help anyone else stuck on this. I had the wrong version of fastcgi_pass unix:/run/php/php7.0-fpm.sock; because I copied the exact same file from the tutorial. Mine was php7.4 not 7.0, changed in the server block and phpmyadmin loaded no problems

Submit an Answer