Check if php-file exists in chroot jail

Francis Daly francis at daoine.org
Thu Mar 22 18:45:57 UTC 2012


On Thu, Mar 22, 2012 at 05:24:10AM -0400, maverick78 wrote:

Hi there,

> Ops, sorry. It's www. Tht was a fault of mine and I corrected it. But
> it's the same result. Every .php-page shows 404 not found.

This time, I've actually tested what I suggest ;-)

try_files takes arguments of uris, which it then looks for as files by
prefixing $document_root.

So you must leave "root" set correctly for nginx if you want nginx to
care about files.

Without try_files in this case, nginx doesn't care about files; with it,
it does.

So: leave "root" alone (as /www/example.com/public), and just set the
correct fastcgi_param values.

Something like:

  include fastcgi.conf;
  fastcgi_param  SCRIPT_FILENAME    /public$fastcgi_script_name;

could be sufficient. You might also want

  fastcgi_param  DOCUMENT_ROOT    /public;

if your code cares about that variable.

Then "try_files $uri =404" and "fasctcgi_pass ..." work for me.

> And the
> dubug-log only complains about the favicon that cannot be found. But the
> file hello.php (a hello world script) definitely exists.

For information: that's not the debug log.

The debug log shows every uri / filename that try_files tests (among
many other things).

If you still have difficulties, it may be worth enabling the debug log
just to see what it does show.

Good luck with it,

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list