It’s surprising how much incorrect informations are available on web for this topic. I was struggling to get correct configuration for simpleSAMLphp package (on Ubuntu 14.04). This is finally correct config (inside server section):
rewrite ^(/simplesaml/?)(.*) /saml/www/$2 break; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; } location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; }
Key insight is to set additionally two CGI parameters SCRIPT_FILENAME and PATH_INFO, but after include fastcgi_params
(this configuration also sets SCRIPT_FILENAME).
Also I had to change php.ini:
cgi.fix_pathinfo=0