I’m experiencing 502 Gateway
errors when accessing a PHP file in a directory (http://example.com/dev/index.php
)
Start php-fpm
and add the following to nginx.conf
, in the http
context:
server {
listen 127.0.0.1;
server_name localhost;
error_log /var/log/nginx/localhost.error_log info;
root /var/www/localhost/htdocs;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
fastcgi_intercept_errors on;
error_page 404 /error/404.php;
}
}