Welcome! Log In Create A New Profile

Advanced

Confusion over apparently conflicting advice in guide/wiki/examples

March 03, 2014 04:11PM
I'd call myself very much a beginner with NGiNX, but I've been looking further through the documentation, particularly the http://wiki.nginx.org/Pitfalls page, and now I'm left with confusion!

This page http://wiki.nginx.org/PHPFcgiExample says
"This guide run fine on php.ini cgi.fix_pathinfo = 1 (the default). Some guide insist to change it to cgi.fix_pathinfo = 0 but doing that make PHP_SELF variable broken (not equal to DOCUMENT_URI).".

But http://wiki.nginx.org/Pitfalls says:
Set cgi.fix_pathinfo=0 in php.ini. This causes the PHP interpreter to only try the literal path given and to stop processing if the file is not found.

And the provided nginx/sites-available/default says
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini

Which is correct?

My second question: As I understand it, you should always make parameter changes only where they are needed, and in an overriding way - ie: one never touches php.ini itself.
So, I am looking at this entry:

http://wiki.nginx.org/Pyrocms

In the server stanza there is:

server {
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
fastcgi_read_timeout 180;
....

and then separately it says to add to fastcgi_params the following:

fastcgi_connect_timeout 60;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
fastcgi_intercept_errors off;

Some of those numbers are HUGE - most of the buffer defaults are normally 4k|8k. And 3 minutes between connections? Is this over-the-top? And the three items in server are conflicted by different values in fastcgi params.

And isn't that going to "pollute" the whole fpm server? I thought it would be better to have it in the fpm pool, so first I had it like this:

php_value[upload_max_filesize] = 128M
php_value[max_file_uploads] = 60
php_value[default_socket_timeout] = 180
php_value[date.timezone] = 'Europe/London'
php_value[session.gc_maxlifetime] = 28800


The I realised I only needed these high values for one area of my server, so again I changed it:

location ~ /upload/ {
location ~ \.(php)$ {
try_files $uri =404;
set $php_value "post_max_size = 128M";
set $php_value "$php_value \n upload_max_filesize = 128M";
set $php_value "$php_value \n session.gc_maxlifetime = 28800";
set $php_value "$php_value \n max_file_uploads = 60";
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PHP_VALUE $php_value;
include fastcgi_params;
}
}

And it works fine. No core ini files are touched, only the area which need to change is changed.

Also, the example config has:

location ~ \.php {
fastcgi_pass unix:/tmp/domain.sock;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;

But the Pitfalls guide suggests this is dangerous.

So, my question would be:

Is this example file wrong/outdated/dangerous?

Or am I completely misunderstanding something?
SubjectAuthorPosted

Confusion over apparently conflicting advice in guide/wiki/examples

talkingnewsMarch 03, 2014 04:11PM

Re: Confusion over apparently conflicting advice in guide/wiki/examples

B.R.March 04, 2014 04:02AM

Re: Confusion over apparently conflicting advice in guide/wiki/examples

talkingnewsMarch 04, 2014 03:51PM

Re: Confusion over apparently conflicting advice in guide/wiki/examples

talkingnewsMarch 05, 2014 04:52PM

Re: Confusion over apparently conflicting advice in guide/wiki/examples

Francis DalyMarch 04, 2014 04:42PM

Re: Confusion over apparently conflicting advice in guide/wiki/examples

Francis DalyMarch 05, 2014 06:32PM

Re: Confusion over apparently conflicting advice in guide/wiki/examples

Francis DalyMarch 04, 2014 04:32PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 67
Record Number of Users: 5 on December 17, 2014
Record Number of Guests: 154 on December 17, 2014
Powered by nginx    Powered by FreeBSD    PHP Powered    Powered by Percona     ipv6 ready