I have come across an error that I have been having difficulty fixing.
I am suspicious the problem is the "Primary script unknown" error, but I am lost. There is an reoccurring Fatal Error, but it is a core file that has never been modified..

Any help would be greatly appreciated.

See below for an example of the nginx error log.

2016/01/09 08:08:17 [error] 1082#0: *315 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client:, server: , request: "GET http://dhg.pisz.pl/httptest.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "dhg.pisz.pl"

1 Answer 1


The error you've shown is from someone running a hacking script.

The nginx documentation offers many solutions to avoid running bad php scripts in their Pitfalls and Common Mistakes FAQ, but the one I like is the try_files directive to only run scripts that exist on your server otherwise return a 404 Not Found status code.

location ~* \.php$ {
    try_files $uri =404;
    fastcgi_pass backend;
    # [...]
  • Thank you, I will try this when I have a little more time and let you know how it works. And if you don't mind, if I cannot work my way through the guide, I may have a question or two.I really appreciate the help and guidance.
    – Bestinc
    Commented Jan 10, 2016 at 21:04
  • Hello, I have added try_files to the nginx/sites-available but I the website still only shows the NGINX error page for every single page. There seems to be something that is creating a disconnect between my site and the server. Is it possible I am just not employing the try_files correctly? Thank you
    – Bestinc
    Commented Jan 12, 2016 at 0:47
  • Hello Bestinc, I have no information to answer your question. What errors do you see in the nginx/php logs? Is the PHP server running? Do you have a missing semicolon?
    – Jason
    Commented Jan 12, 2016 at 7:20
  • PHP is running. I can get to my phpinfo() variable. The errors that keep showing up are Primary Script Unknown errors. I have since found out that Every page is sent to a 503 error page except the login page that attempts and fails to redirect to some other page. It seems like there is a script running on there for sure, redirecting the pages/obscuring the page loads.
    – Bestinc
    Commented Jan 13, 2016 at 0:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.