【发布时间】:2021-11-05 04:51:42
【问题描述】:
我用 laravel 和 nuxt 做了一个应用。我使用 nginx 将它部署到服务器。 我的nginx代码是这样的
server {
listen 80;
root /home/anjaan/desijewel/api/public;
index index.php index.html index.htm index.nginx-debian.html;
server_name 206.189.142.151;
location /api {
try_files $uri $uri/ /index.php?$query_string;
}
location / {
// Reverse proxy code from nuxtjs.org
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
location ~ /\.(?!well-known).* {
deny all;
}
location /phpmyadmin {
alias /home/anjaan/desijewel/;
index index.php;}}
我将 phpmyadmin 链接到 /home/anjaan/desijewel。 但现在它显示 403 错误。
当我将它链接到 /api/public(Laravel 文件夹) 时它工作正常。 并显示 nginx 错误日志 -
access forbidden by rule, client: 1.39.244.47, server: 206.189.142.151, request: "GET /jyoteshdb/ HTTP/1.1", host: "206.189.142.151"
【问题讨论】:
-
试试this 回答。用你的
unix:/var/run/php/php7.4-fpm.sock替换套接字路径,如果它不起作用,用include fastcgi_params;替换include fastcgi.conf;