Nginx Location Block

Julian De Marchi juliand at
Wed May 27 00:42:49 UTC 2015

On 27/05/15 10:15, Francis Daly wrote:
> Does the backend configuration include anything that would log to a
> different access log, or not log at all?

Apparently so... When I access via the frontend my error log for the
backend looks like below. Which is quite normal.

[haweb-05.vpn] 10:31:58 [err] [local7] [nginx] 2015/05/27 10:31:58
[error] 5060#0: *135068 FastCGI sent in stderr: "Primary script unknown"
while reading response header from upstream, client:,
server:, request: "GET /cms/index.php HTTP/1.0", upstream:
"fastcgi://unix:/var/run/php53-fpm.sock:", host: ""

However when I modify my hosts file to talk directly to one of my
backend servers I get the 404. I'll figure out the logs later, but now I
have the answers I'm after and the culprit of my issue.

    location @rewrite {
      # Some modules enforce no slash (/) at the end of the URL
      # Else this rewrite block wouldnt be needed (GlobalRedirect)
      rewrite ^/(.*)$ /index.php?q=$1;

Thanks for your help.


More information about the nginx mailing list