【发布时间】:2020-04-06 20:47:12
【问题描述】:
我尝试使用 Nginx Web 服务器部署 Laravel 应用程序。但是,我收到 502 Bad Gateway 错误。我检查了位于站点可用文件夹中的默认文件并进行了一些更改。
以下代码 sn -p 显示默认站点配置文件。
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html/laravel/skill-tool-app/public;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name 18.130.196.144;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404 /index.php?$query_string;
}
# pass PHP scripts to FastCGI server
#
#location ~ \.php$ {
# include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
# fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
# # With php-cgi (or other tcp sockets):
#fastcgi_pass 127.0.0.1:9000;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
我也检查了文件权限。当我尝试访问该网站时。它使浏览器下载 index.php 文件。
【问题讨论】:
标签: laravel nginx nginx-config