在Nginx中使用next和Laravel设置Phpmyadmin



我用laravel和next制作了一个应用程序。我用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"

你为什么要把它们都塞进一个配置?

创建一个单独的Phpmyadminserver_name,附属于phpmyadmin.test或其他东西。所以Nginx可以从这个URL访问Phpmyadmin。

现在,可能是一些难以调试的问题。如果你把所有东西分开,管理起来就容易多了。

如果你坚持只有一个文件。检查nginx日志中的错误。/var/log/nginx/error.log

最新更新