I've hit a wall whilst setting up a site using nginx / fpm. The page displays "File not found", and this appears in the nginx error.log:
FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream
I'm new to both nginx and fpm, and that error message means nothing to me (even the google machine hasn't helped!). Can anyone shed any light onto what could be happening?
Best Answer
You should have a
location
section to handle PHP requests configured similarly to this:(The extra
try_files
resolves a security vulnerability which could allow arbitrary files to be executed as PHP.)In addition, your
root
should be defined in theserver
section of the configuration file, not thelocation
section. This is one of the most common nginx misconfigurations.