Bitnami中的Nginx服务器如何配置Laravel项目?总是报502 Bad Gateway
本文介绍了Bitnami中的Nginx服务器如何配置Laravel项目?总是报502 Bad Gateway的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
参考网上的好多配置教程,都失败了,报502错误。
目前我的配置是这样的:/opt/bksite/nginx/conf/bitnami/bitnami.conf
文件
server {
listen 80;
server_name localhost;
proxy_buffer_size 128k;
proxy_buffers 8 256k;
proxy_busy_buffers_size 256k;
set $root_path '/home/paiyang-admin/public/';
root $root_path;
location / {
index index.php index.html index.htm;
try_files $uri $uri/ /index.php;
}
include "/opt/bksite/nginx/conf/bitnami/phpfastcgi.conf";
include "/opt/bksite/nginx/conf/bitnami/bitnami-apps-prefix.conf";
}
/opt/bksite/nginx/conf/bitnami/phpfastcgi.conf
文件如下
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_read_timeout 300;
fastcgi_pass unix:/opt/bksite/php/var/run/www.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
include fastcgi_params;
}
求帮助。
解决方案
尝试一下这样配置
location / {
try_files $uri /index.php$is_args$args;
}
location ~ ^/index\.php(/|$) {
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
}
这篇关于Bitnami中的Nginx服务器如何配置Laravel项目?总是报502 Bad Gateway的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文