My issue:
Loading a PHP file gives 502 Bad Gateway
How I encountered the problem:
I’m attempting to install PHP with NGINX. I’ve install PHP 8.1 and done what I think is the correct config, but i can’t reach index.php on the server. It gives a 502. If I hit index.html all is well.
Solutions I’ve tried:
apt install php-fpm php-mysql
I edited my .conf file.
completed a nginx -t which had no issues
restarted nginx
My config:
nginx 1.26.3
Ubuntu 22.04.5 LTS
my .conf for the domain:
server {
location / {
root /var/www/html/<my folder>
try_files $uri $uri/ /index.php$is_args$args;
}
server_name <domain name>;
index index.php index.html index.htm;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php8.1-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
(other stuff for port 443 ssl )