Floréal C
Floréal C

Reputation: 98

Phpmyadmin as subdomain in Nginx

I try to use phpmyadmin as a subdomain of my website. Now, it work perfectly with Apache but I try to go to Nginx.

On Nginx, the phpmyadmin login page works well, but when I login, I stay on the login page even if my credentials are correct, with no error message (if I enter a bad password I have an error shown).

What is wrong? Here is my config file:

server {
    listen       80;
    server_name  phpmyadmin.mydomain.fr;

    root /usr/share/phpmyadmin;
    index index.php;

    location / {
         try_files $uri $uri/ /index.php?$args;
    }

    error_page  404              /404.html;
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
    root   /usr/share/nginx/html;
    }

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

As you can see, I want to use phpmyadmin in a subdomain of my website. If I make a link to /var/www/html/phpmyadmin and access to http://mydomain.fr/phpmyadmin, all works perfectly. But I failed to make it working with a subdomain.

What is wrong?

Thank you for your answer in advance, and sorry for my bad english

Floréal

Upvotes: 2

Views: 3662

Answers (1)

Floréal C
Floréal C

Reputation: 98

Oh... It's just a cache problem. I remove all cache from my browser and it works now with this config:

server {
listen       8000;
server_name  mdbadmin.flo-art.fr;

root /usr/share/phpmyadmin;
index index.php;

location ~ \.php$ {
    fastcgi_split_path_info ^(.+\.php)(/.*)$;
    fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
}

}

Upvotes: 2

Related Questions