phgdl19
By:
phgdl19

Phpmyadmin redirect to http://127.0.0.1/index.php?token=... after login (Nginx)

August 17, 2016 1.3k views
Nginx MySQL Ubuntu 16.04

When i log in phpmyadmin, aways redirect to "http://127.0.0.1/index.php?token=...", shoud be "http://127.0.0.1/phpmyadmin/index.php?token=...".

This is my nginx/conf.d/default.conf.

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

    root /var/www;
    index index.php index.html index.htm *;

    server_name 127.0.0.1;


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

    location ~ /\.ht {
        deny all;
    }

    #location /phpmyadmin {
    #    index index.php index.htm;
    #    alias /usr/share/phpmyadmin;
    #}

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

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

}
1 Answer
Have another answer? Share your knowledge.