【发布时间】:2021-03-10 13:33:23
【问题描述】:
我需要解决一个问题。我有公共地址的ngnix,我需要通过ip在本地网络中使用phpmyadmin访问我的数据库。我已经按照指南在地址 /usr/share/phpmyadmin 配置了它。目前我可以从这个目录下载 php 文件但没有执行。我需要做什么才能从浏览器连接到 phpmyadmin? 这是我的 ngnix 配置:
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.html index.htm;
server_name 192.168.1.101;
location ^~ /permanentmark/ {
alias /usr/share/phpmyadmin/;
index index.php index.html;
location ~ /pma(/.*\.php) {
include fastcgi_params;
fastcgi_param SERVER_NAME localhost;
fastcgi_param SCRIPT_FILENAME /usr/share/phpmyadmin$1;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
}
}
}
【问题讨论】:
-
您的嵌套位置与 URI 不匹配,请使用
location ~ \.php$和fastcgi_param SCRIPT_FILENAME $request_filename;。见this answer。
标签: mysql nginx phpmyadmin