When trying to make phpmyadmin work on my Nginx server, it rewrites the request https://fellowshipmedia.eu/phpmyadmin to https://fellowshipmedia.eu/index.php.
I tried to read the error.log with 'rewrite_log' and 'debug' flag set, but the log is very hard to understand for me. I can see that at a certain point the prefix of the path gets dropped, but why?
This is part of the nginx conf file:
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
ssl_certificate /etc/letsencrypt/live/fellowshipmedia.eu/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/fellowshipmedia.eu/privkey.pem;
include snippets/ssl-params.conf;
server_name fellowshipmedia.eu;
root /usr/share/nginx/html/fellowshipmediaeu/httpsdocs/;
index index.php index.html index.htm ;
location / {
try_files $uri $uri/ /index.php?page=$uri;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
}
This is the access.log:
86.83.94.220 - - [10/Jun/2017:07:24:10 +0200] "POST /phpmyadmin/index.php HTTP/2.0" 302 619 "https://fellowshipmedia.eu/phpmyadmin/index.php?db=&token=66594ef803698c67dfd27ab17d089a78&old_usr=root" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0"
86.83.94.220 - - [10/Jun/2017:07:24:10 +0200] "GET /index.php?token=cd06ccda9c2d36a7600e99474755558a HTTP/2.0" 404 233 "https://fellowshipmedia.eu/phpmyadmin/index.php?db=&token=66594ef803698c67dfd27ab17d089a78&old_usr=root" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0"
This is the error.log: https://pastebin.com/0BKXVjza
This is fastcgi-php.conf:
fastcgi_split_path_info ^(.+\.php)(/.+)$;
try_files $fastcgi_script_name =404;
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;
fastcgi_index index.php;
include fastcgi.conf;
It is
phpmyadmin
which redirects initial request to incorrect/index.php
with status 302. Check thatphpmyadmin
receives initial request with correct prefix throughFastCGI
- this part is missing from your logs and depends on content ofsnippets/fastcgi-php.conf
which is also missing from your post. Also checkphpmyadmin
own setting, e.g PmaAbsoluteUri.I found another answer in this thread: Nginx phpmyadmin redirecting to / instead of /phpmyadmin upon login
Add this to the serverblock to help phpmyadmin find its location: