当试图让 phpmyadmin 在我的 Nginx 服务器上工作时,它会将请求https://fellowshipmedia.eu/phpmyadmin重写为https://fellowshipmedia.eu/index.php。
我尝试读取设置了“rewrite_log”和“debug”标志的error.log,但日志对我来说很难理解。我可以看到在某个时刻路径的前缀被删除了,但是为什么呢?
这是 nginx 配置文件的一部分:
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;
}
}
这是 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"
这是错误日志:https ://pastebin.com/0BKXVjza
这是 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;
它将
phpmyadmin
初始请求重定向到/index.php
状态 302 不正确。检查是否phpmyadmin
接收到具有正确前缀的初始请求FastCGI
- 您的日志中缺少这部分,并且取决于snippets/fastcgi-php.conf
您的帖子中也缺少的内容。还要检查phpmyadmin
自己的设置,例如 PmaAbsoluteUri。我在这个线程中找到了另一个答案:Nginx phpmyadmin redirecting to / instead of /phpmyadmin on login
将此添加到 serverblock 以帮助 phpmyadmin 找到它的位置: