FreeBSD Logo

I had an issue while trying to run a php-fpm FastCGI process from a FreeBSD jail using nginx from the host. Like many others I experienced the infamous White Screen Of Death™ but no errors were logged at all (even with the full debug config all set from both php-fpm.conf and php.ini).

nginx.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# ...
upstream princesse-bulldozer-php-fpm {
    server [2a01:4f8:120:5388:0:b:249:1]:9000;
} server {
    listen   *:80;
    listen   [::]:80;
    # ...
    root /usr/jails/jail0.kaworu.ch/home/princesse-bulldozer.ch/wordpress;
    index index.php;
    # Pass all .php files onto a php-fpm/php-fcgi server.
    location ~ [^/]\.php(/|$) {
        fastcgi_index index.php;

        fastcgi_pass princesse-bulldozer-php-fpm;
        # fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param SCRIPT_FILENAME /home/princesse-bulldozer.ch/wordpress$fastcgi_script_name;
        include fastcgi_params;
    }
}
  1. As nginx is run from the host, using the "full" path as root is correct.
  2. Since php-fpm is jailed, the SCRIPT_FILENAME path should not use $document_root
  3. … but use the "jailed" path instead.

Hope it can avoid a couple of painful debugging out there :)