由于某种原因,我无法让我的网站正常运行。我已按照 DevMarketer Laravel 网站部署中的所有步骤进行操作,但出现以下错误:
502 Bad Gateway
nginx/1.16.1 (Ubuntu)
我知道 Nginx 的配置有问题,但在看到许多类似问题的答案后,我无法让它正常工作。下面是我的 nnginx.conf 文件:
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/mydomain/public;
index index.php index.html index.htm;
server_name mydomain.com;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass 127.0.0.1:9000;
}
location ~ /\.ht {
deny all;
}
}
FastCGI 的 php.conf 文件
# regex to split $uri to $fastcgi_script_name and $fastcgi_path
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
# Check that the PHP script exists before passing it
try_files $fastcgi_script_name =404;
# Bypass the fact that try_files resets $fastcgi_path_info
# see: http://trac.nginx.org/nginx/ticket/321
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;
fastcgi_index index.php;
include fastcgi.conf;
我的 Laravel 网站包含一个数据库,并在 PHP 7.3 上运行。服务器提供商名为 Vultr。
非常感谢您的帮助。