gpt4 book ai didi

nginx - SSL 的 phpMyAdmin 页面 404 Not Found [Nginx + Centos7.5]

转载 作者:行者123 更新时间:2023-12-04 19:40:02 25 4
gpt4 key购买 nike

我正在学习 Nginx。我想问一下带有 SSL 的 phpMyAdmin。
我用 2 个静态域做了 Cerbot SSL。我可以访问 phpMyAdmin。
作为 http://mywebiste.com/phpMyAdmin/
但是当我打开 https://mywebiste.com/phpMyAdmin/
错误说

404 Not Found.


我一直在搜索错误日志。但我仍然不知道如何在 pma 设置日志,所以我看不到它。
请教我写设置代码好吗?
这是我当前的设置文件。

vi /etc/nginx/conf.d/phpmyadmin.conf

server {
#listen 80;
listen 443 ssl;
ssl_certificate /etc/letsencrypt/live/mywebiste.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/mywebiste.com/privkey.pem;


server_name mywebiste.com/phpmyadmin;

location / {
root /usr/share/phpMyAdmin;
index index.php;
}

location ~ \.php$ {
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/phpMyAdmin/$fastcgi_scr
ipt_name;
include fastcgi_params;
}
}

最佳答案

不要在 server_name 中使用 uri 链接多变的。此变量仅用于域名,没有 http , https , /或其他符号。
我稍微改变了你的配置:

server {
listen 443 ssl;
server_name mywebiste.com;

ssl_certificate /etc/letsencrypt/live/mywebiste.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/mywebiste.com/privkey.pem;

root /usr/share/phpMyAdmin/;

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

location ~ \.php$ {
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
在这种情况下,如果使用 URL https://mywebiste.com,则打开 PhpMyAdmin或 https://mywebiste.com/index.php .
如果您需要此网址 https://mywebiste.com/phpMyAdmin/index.php更改变量 rootlocation / .也可以使用单独的位置,例如 67349181问题。
您可以使用 nginx -t 验证配置命令。问题会一直写入错误日志,默认 /var/log/nginx/error.log说如果您需要更多信息。

关于nginx - SSL 的 phpMyAdmin 页面 404 Not Found [Nginx + Centos7.5],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67369817/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com