Fixing ruTorrent errors with nginx 1.6.1-2
The nginx 1.6.1-2 release on Debian Backports made a change to the default fastcgi configuration file with an almost casual reference in the release notes:
* debian/conf/fastcgi_params: + Sync with upstream and remove `SCRIPT_FILENAME` parameter. This change might break fastcgi sites. (Closes: #718639)
Talk about an understatement – that change broke every single PHP based site I manage (including this blog).
Fixing the errors from this change depends on how ruTorrent is setup – If ruTorrent is running as the only application on the site then the change is fairly straight forward, change the location handler for PHP files to include the SCRIPT_FILENAME parameter:
location ~ \.php$ { include /etc/nginx/fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass @phpfpm; }
On the other hand, if ruTorrent is setup to run from a subfolder off the main site, i.e. http://site.com/rutorrent the parameter is quite different and figuring out what is the correct syntax proved to be surprisingly difficult. I could never get the ruTorrent debug log to work and the on-screen error messages are singularly unhelpful. The magic incantation for ruTorrent as a subfolder is to use REQUEST_FILENAME in the fastcgi_param config instead:
location ~ \.php$ { include /etc/nginx/fastcgi_params; fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_pass @phpfpm; }