A complicated nginx/php-fpm chroot setup
Solution 1:
The problem is here:
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
Your PHP runs in a chroot in /var/www/domain.name
, but your document root is /var/www/domain.name/public
. So when you load up /index.php
the SCRIPT_FILENAME
becomes /var/www/domain.name/public/index.php
. But, in the chroot this doesn't exist! It is at /public/index.php
instead.
What you can do is to change the directory here so that it matches the view from the chroot:
fastcgi_param SCRIPT_FILENAME /public$fastcgi_script_name;
Solution 2:
What would work is to set in the nginx conf:
root /public;
I've tried this and works, but in case you have mysql db to connect to, that wont work at all. This is my limitation too, made it work, but couldn't connect to mysql db due to the socket.