Check if php-file exists in chroot jail

maverick78 nginx-forum at nginx.us
Wed Mar 21 17:10:19 UTC 2012


Thanks for your reply.

I got stuck with finding out the proper settings.

My files are located in /www/example.com/public. This is set as document
root in nginx server block.

In my pool of php-fpm I set a chroot path.

chroot = /www/example.com

That's why I have to set another path to document_root in my location
block for php-files.

root /public;

With these settings all my php-files are delivered by php-fpm. Nothing
to complain about. So, permissions and paths sem to be correct.

For security reasons I want to check, if the called file with
php-extension really exists. For this purpose I want to use try_files.
But when I put try_files $uri =404; in the php location block, I always
get an 404 error for php-files.

I think nginx cant find the right path because of the chroot setting in
php-fpm. Is the a way to get around this?

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,224182,224188#msg-224188



More information about the nginx mailing list