trwnh / nginx-config-hacks

a personal repo of hacks i use to make nginx configs a tiny bit easier to manage
http://sites.trwnh.com
The Unlicense
1 stars 0 forks source link

$document_root$fastcgi_script_name VS $request_filename #2

Open trwnh opened 5 years ago

trwnh commented 5 years ago

https://blog.martinfjordvald.com/2013/04/nginx-config-history-fastcgi_params-versus-fastcgi-conf/

i can't seem to find any downsides to just using $request_filename 100% of the time over $document_root$fastcgi_script_name for SCRIPT_FILENAME. $request_filename just seems to be less likely to break -- it takes alias into account,

Also https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/#use-request-filename-for-script-filename

And if you use $request_filename, you should set index using index directive, fastcgi_index will not work.

which seems to be the only pitfall, per se.

trwnh commented 5 years ago

seems to work fine in testing. maybe make the switch

trwnh commented 5 years ago

actually maybe snippets/phpsub.conf can just replace snippets/php.conf? since that's basically what the change boils down to