I have set up a local server on my laptop for web development and to check the website I'm working on I should have my code base in /var/www/example.domain which is not so convenient, I want Nginx to retrieve the files and parse PHP from my home directory, something like /home/projects/test-one/ but if I add this directory to root it'll throw me a 502 Bad Gateway error
here's my configuration:
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
location / {
root /home/amirreza/Projects/escribir/;
index index.php index.html index.htm;
}
location ~* \.php$ {
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
}
in /etc/nginx/sites-available/default, I'm on Debian 11