I'm trying to test out php-fpm's "Accelerated upload support" as outlined here:
http://php-fpm.org/wiki/Features#Accelerated_upload_support
Here's the location block I'm using:
location ~ \.php$ {
# start PHP-fpm upload optimiztaion
client_body_temp_path /dev/shm/client_body_temp;
fastcgi_pass_request_body off;
client_body_in_file_only on;
fastcgi_param REQUEST_BODY_FILE $request_body_file;
# end PHP-fpm upload optimiztaion
fastcgi_pass unix:/dev/shm/php.sock;
include fastcgi_params;
break;
}
The problem is that nginx is writing to the client_body_temp_path with such strict permissions and php-fpm running as "nobody" cannot read the client body file.
For example, nginx writes the client body file:
# ls -la /dev/shm/client_body_temp
total 4
drwx------ 2 nginx root 60 Mar 24 01:19 .
drwxr-xr-x 3 root root 80 Mar 24 01:04 ..
-rw------- 1 nginx nginx 319 Mar 24 01:19 0000000001
But PHP cannot read the file because of failed permissions.
2010/03/24 01:19:52 25348#0: *3 a client request body is buffered to a temporary file /dev/shm/client_body_temp/0000000001, client: 67.142.130.26, server: testforum.mysite.com, request: "POST /login.php?do=login HTTP/1.1", host: "testforum.mysite.com", referrer: "http://testforum.mysite.com/admincp/index.php"
2010/03/24 01:19:52 25348#0: *3 FastCGI sent in stderr: "PHP Warning: REQUEST_BODY_FILE: open('/dev/shm/client_body_temp/0000000001') failed: Permission denied (13) in Unknown on line 0" while reading response header from upstream, client: xx.xxx.xxx.xx, server: testforum.mysite.com, request: "POST /login.php?do=login HTTP/1.1", upstream: "fastcgi://unix:/dev/shm/php.sock:", host: "testforum.mysite.com", referrer: "http://testforum.mysite.com/admincp/index.php"
Is there a way to make this work, other than running nginx as the user "nobody"?
Thanks for your help,
James
Posted at Nginx Forum: http://forum.nginx.org/read.php?3,67197,67197#msg-67197
> To unsubscribe from this group, send email to highload-php-en+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
>
Hi,
You should ask to nginx mailing list. For sure someone there will have
an answer.
++ Jerome
>
> For example, nginx writes the client body file:
>
> # ls -la /dev/shm/client_body_temp
> total 4
> drwx------ 2 nginx root 60 Mar 24 01:19 .
> drwxr-xr-x 3 root root 80 Mar 24 01:04 ..
> -rw------- 1 nginx nginx 319 Mar 24 01:19 0000000001
>
>
> But PHP cannot read the file because of failed permissions.
>
> 2010/03/24 01:19:52 25348#0: *3 a client request body is buffered to a temporary file /dev/shm/client_body_temp/0000000001, client: 67.142.130.26, server: testforum.mysite.com, request: "POST /login.php?do=login HTTP/1.1", host: "testforum.mysite.com", referrer: "http://testforum.mysite.com/admincp/index.php"
> 2010/03/24 01:19:52 25348#0: *3 FastCGI sent in stderr: "PHP Warning: REQUEST_BODY_FILE: open('/dev/shm/client_body_temp/0000000001') failed: Permission denied (13) in Unknown on line 0" while reading response header from upstream, client: xx.xxx.xxx.xx, server: testforum.mysite.com, request: "POST /login.php?do=login HTTP/1.1", upstream: "fastcgi://unix:/dev/shm/php.sock:", host: "testforum.mysite.com", referrer: "http://testforum.mysite.com/admincp/index.php"
>
>
> Is there a way to make this work, other than running nginx as the user "nobody"?
>
> Thanks for your help,
> James
>
> Posted at Nginx Forum: http://forum.nginx.org/read.php?3,67197,67197#msg-67197
>
So you are suggesting setting the Unix user/group of processes to "nginx" in the php-fpm configuration file?
It seems the only other option because nginx will always set the permissions to files in the client_body_temp_path to it's own user/group.
Thanks,
James
Posted at Nginx Forum: http://forum.nginx.org/read.php?3,67197,67205#msg-67205
Btw, different users with equal group won't help here - you have 600
rights for the body file (group can't read). You probably should play
with umask in your nginx starting script - or use one and the same
user, not group.
--
wbr,
fisher
This /is/ the nginx mailing list.
Posted at Nginx Forum: http://forum.nginx.org/read.php?3,67197,145259#msg-145259