3

I have configured access to a local directory through an nginx alias + php support: https://mydomain.de/wbg points to /var/www/wallabag. Everything was working fine until I did a normal apt-get update && apt-get upgrade on the server (running on debian 8). Now when I open the site I only get "No input file specified.". Here is what nginx says:

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"

This is the important part of my config:

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;
        }
    }
}

How is it possible that this config breakes after an update? And how can I fix it?

(nginx version is 1.6.2-5+deb8u1 after the upgrade, php5-fpm: 5.6.17+dfsg-0+deb8u1)

1 Answer 1

2

The simple answer is that the error message is consistent with your configuration as you have it now - so I have no idea how it worked before the update.

The fastcgi_param SCRIPT_FILENAME $request_filename$fastcgi_script_name line is generating a value of /var/www/wallabag/index.php/wbg/index.php because:

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

If you do not use path info (that's the URI following the .php) you might simplify the PHP part of the configuration and just use $request_filename. Something like:

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

However, to construct a SCRIPT_FILENAME from a URI with path info, you could use:

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;
}

Notice that fastcgi_split_path_info removes the /wbg prefix from the URI in order to construct the correct value for SCRIPT_FILENAME.

2
  • When I try that then the debug output contains fastcgi param: "PATH_INFO: " and fastcgi param: "SCRIPT_FILENAME: /var/www/wallabag//wbg/index.php" plus the original error message. Feb 21, 2016 at 19:35
  • @thomas.mc.work I added a ? to make the last capture optional. Feb 21, 2016 at 20:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .