I was trying to set up linux-dash on my server running gunicorn with nginx as reverse proxy. I tried setting up the configuration file as suggested here. Every time I try to open one of the php scripts in the browser, it throws a "404 not found" error. As far as I understand the following block in the configuration file is responsible for it.
location ~ \.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/run/php5-fpm.sock;
#fastcgi_pass localhost:9000; # using TCP/IP stack
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
try_files $uri $uri/ /index.php?$args;
include fastcgi_params;
}
Can someone help me understand what the condition in the if block actually means? And where am I going wrong?
As far as the location directive is concerned, what I understand from it is that it tries to find if a php script needs to be executed and accordingly splits the path to the script and somehow using fastcgi runs that script on the browser. Please correct me if I am wrong and provide a better understanding of what it means.
It is checking for the existence of file. Ensure the path exists. You should try to use try_files
instead.