Location not called properly

Francis Daly francis at daoine.org
Mon Oct 24 20:12:48 UTC 2011


On Mon, Oct 24, 2011 at 07:02:35AM -0400, TECK wrote:

Hi there,

> The fastcgi value is the name of my upstream.

Yes, that part works.

> The idea is: once the location  /somedir/file1.php is reached,
> everything in @cache should execute.

If you *really* want to do it that way, it would be something like

    try_files /no-such-file @cache;

But you probably don't want to do it that way.

> In this way, I don't repeat several times the same code.

If you don't want to *see* lots of repetition in nginx.conf, use
"include".

If you don't want to *write* lots of repetition in nginx.conf, use a
separate generator to create it.

> This works:
> 
> location /somedir/file1.php {

This will match "/somedir/file1.php", and "/somedir/file1.phpX", and
"/somedir/file1.php/X", for any X.

Although later config will likely block anything except
"/somedir/file1.php" from being processed.

> This does not:
> location = /somedir/file1.php {

This will match only "/somedir/file1.php".

> try_files @cache =404;

This will serve the file "/usr/local/nginx/html at cache", or else
return 404. (try_files tries files. Only the last parameter is handled
specially.)

Either make it "try_files /no-such-file @cache;", or replace it with
"include my-repeated-php-config-file;"

Good luck,

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list