nginxconfiguration与PHP和别名更新后损坏

我已经通过nginx别名+ php支持configuration了对本地目录的访问: https://mydomain.de/wbg /var/www/wallabag指向/var/www/wallabag 。 一切工作正常,直到我做了一个正常的apt-get update && apt-get升级在服务器上(运行在Debian 8上)。 现在当我打开网站,我只得到“没有指定input文件”。 这是nginx所说的:

 2016/02/20 13:07:14 [error] 4376#0: *1 FastCGI sent in stderr: "Unable to open primary script: /var/www/wallabag/index.php/wbg/index.php (No such file or directory)" while reading response header from upstream, client: 78.50.228.24, server: mydomain.de, request: "GET /wbg/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mydomain.de" 

这是我的configuration的重要部分:

 server { server_name mydomain.de; listen 443 ssl default_server; listen [::]:443 ssl default_server; # ssl configuration # ... root /var/www/html; index index.php index.html index.htm index.nginx-debian.html; location / { # ... } location /wbg/ { alias /var/www/wallabag/; index index.php; location ~ ^.+?\.php(/.*)?$ { fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_split_path_info ^(.+\.php)(/.*)$; set $path_info $fastcgi_path_info; fastcgi_param PATH_INFO $path_info; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $request_filename$fastcgi_script_name; } } } 

更新后这个configuration如何破解? 我该如何解决?

(nginx升级版本是1.6.2-5 + deb8u1,php5-fpm:5.6.17 + dfsg-0 + deb8u1)

简单的答案是,错误信息与您现在的configuration一致 – 所以我不知道在更新之前它是如何工作的。

fastcgi_param SCRIPT_FILENAME $request_filename$fastcgi_script_name行生成的值为/var/www/wallabag/index.php/wbg/index.php因为:

 $request_filename = /var/www/wallabag/index.php $fastcgi_script_name = /wbg/index.php 

如果你不使用path信息(这是.php的URI),你可以简化configuration的PHP部分,并使用$request_filename 。 就像是:

 location ~ \.php$ { fastcgi_pass unix:/var/run/php5-fpm.sock; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $request_filename; } 

但是,要从具有path信息的URI构造SCRIPT_FILENAME,可以使用:

 location ~ \.php(/|$) { fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_split_path_info ^/wbg(.+\.php)(/.*)?$; include fastcgi_params; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } 

请注意, fastcgi_split_path_info从URI中删除/wbg前缀,以便为SCRIPT_FILENAME构造正确的值。