Check if php-file exists in chroot jail

Valentin V. Bartenev ne at vbart.ru
Wed Mar 21 16:12:49 UTC 2012


On Wednesday 21 March 2012 18:05:38 maverick78 wrote:
> Hello!
> 
> I configured php-fpm to use build-in chroot. Everything works fine, but
> there ist a problem when I try to check if a php-file exists.
> 
> server {
> location ~ \.php$ {
> root /public;
> try_files $uri =404;
> }
> }
> 
> In this case, I alsways get 404 not found for php-files.
> 
> When I comment out try_files, the php-files are processed.
> 
> Is there a way of proper configuration in this case? How can I check if
> a php-file really exists before I pass it to php-fpm?
> 

By setting proper root and permissions. If you get 404 here:

  location ~ \.php$ {
      root /public;
      try_files $uri =404;
  }

then /public/$uri isn't accessible to nginx or it doesn't exist. See error/debug 
log for additional information.

 wbr, Valentin V. Bartenev



More information about the nginx mailing list