Nginx 1.7.0: location @php

Francis Daly francis at
Sat May 31 09:59:37 UTC 2014

On Sat, May 31, 2014 at 01:59:18AM -0400, TECK wrote:

Hi there,

> > Answer #1: what does "does not work" mean?
> When I process an URI request, it downloads the file instead of executing
> the PHP code.

Perhaps the request that you made did not match the location blocks that
you showed?

That's the way I can get the specific unwanted response that you
report here.

> What I try to achieve is very simple, use @php as location to execute PHP
> code instead of repeating it over and over in various locations. Here it is
> a better example of a functional setup:

If it matters to the question, can you include the (minimal) configuration
in the mail directly? That way, it will be available for the next person
who searches the archives.


I'm guessing that you may want something like

  try_files i-dislike-macro-include @php;

Good luck with it,

Francis Daly        francis at

More information about the nginx mailing list