404 After Logging in Phpmyadmin with Nginx

404 After Logging in Phpmyadmin with Nginx

I just installed LEMP stack but my phpmyadmin is acting weird every time I log in. After login, I always get error 404.

This is the URL after logging in (NOTE the user is now logged in):


and I get error 404.

When I type localhost/phpmyadmin, it now works normally.

3

1 Answer

This is a : no need to think setup for Ubuntu 16.04 with php7-fpm already installed.

sudo apt-get install phpmyadmin

Then copy paste just before the last } of the file the following block into /etc/nginx/sites-avaliable/default

    location /phpmyadmin {
        root /usr/share/;
        index index.php index.html index.htm;
        location ~ ^/phpmyadmin/(.+\.php)$ {
            try_files $uri =404;
            fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

        }
        location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
            root /usr/share/;
        }
    }

Save and restart nginx with :

sudo service nginx restart
5

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Chloe Bennett
Author

Chloe Bennett

Chloe Bennett explores the intersection of pop culture, streaming entertainment, digital trends, and contemporary lifestyle. Her weekly commentary reaches thousands of culture enthusiasts.