Set a PHP parameter for only one location

I have a “standard” location block for my php directives…

Pass all .php files onto a php-fpm/php-fcgi server.

location ~ .php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+.php)(/.+)$;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass php;
}

But…I want to set a php_value for a specific directory. Is there a
more elegant method than duplicating all the directives for the “global”
php handler above for the directory?


Daniel

On 02.04.2015 0:12, Daniel Miller wrote:

}

But…I want to set a php_value for a specific directory. Is there a
more elegant method than duplicating all the directives for the “global”
php handler above for the directory?

Detailed answer on your question from Igor S., creator of nginx:

on English:
https://www.youtube.com/watch?v=YWRYbLKsS0I
Scaleable NGINX Configuration

on Russian:
https://events.yandex.ru/lib/talks/2392/
Масштабируемая конфигурация nginx


Best regards,
Gena

On Wed, Apr 01, 2015 at 02:12:57PM -0700, Daniel Miller wrote:

Hi there,

But…I want to set a php_value for a specific directory. Is there
a more elegant method than duplicating all the directives for the
“global” php handler above for the directory?

I think that “duplicating” is the elegant way.

I suppose that you could put the four useful lines of your config into
an
external file, and “include” that in both your current and new
locations.

But I’d consider that “extra level of indirection” to be less elegant.

(I can’t think of any requests where your “fastcgi_split_path_info” or
“fastcgi_index” directives will do anything useful.)

f

Francis D. [email protected]

Do not be afraid of copy-pasting, those few kB on disk/in memory will
relieve you from pain during maintenance (and it is basically how you
would
manage your configuration using templates).

https://youtu.be/YWRYbLKsS0I

B. R.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs