For some reason, I am unable to get my website working. I have followed all the steps from DevMarketer Laravel website deployment, but I am getting the following error:
502 Bad Gateway
nginx/1.16.1 (Ubuntu)
I am aware there is a problem with the configuration of Nginx, but after seeing many answers from similar problems, I was unable to get this working. Below, is my nnginx.conf file:
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;
My Laravel website includes a database and runs on PHP 7.3. The server provider is called Vultr.
Help will be much appreciated.