本文在CentOS 7.6 x64系统 + Nginx 1.6.0 + PHP 7.3.6环境下验证通过
假设simpleSamlPhp源码解压缩在/srv/www/simplesamlphp目录
Nginx的配置如下
server {
listen 82;
server_name localhost;
set $root_path '/srv/www/simplesamlphp/www';
root $root_path;
index index.php index.html index.htm;
try_files $uri $uri/ @rewrite;
location @rewrite {
rewrite ^/(.*)$ /index.php?_url=/$1;
}
location /simplesaml {
# Location Access and error log files.
access_log /var/log/nginx/simplesaml.access.log;
error_log /var/log/nginx/simplesaml.error.log;
# add alias root to global simple saml install
alias /srv/www/simplesamlphp/www;
index index.php;
location ~ ^(?<prefix>/simplesaml)(?<phpfile>.+?\.php)(?<pathinfo>/.*)?$ {
fastcgi_split_path_info ^(.+?\.php)(/.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$phpfile;
fastcgi_param PATH_INFO $pathinfo if_not_empty;
fastcgi_pass 127.0.0.1:9000;
include /opt/nginx/conf/fastcgi_params;
}
}
location ~ \.php {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index /index.php;
include /opt/nginx/conf/fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
这样子就可以正常运行了