1

My setup

  • Ubuntu 14.04 LTS 64-bit
  • Nginx
  • SimpleSAMLphp 1.13.2

My Nginx server block:

server {
    listen 80;
    listen [::]:80;

    root /var/www/sso/html;
    index index.php index.html index.htm;

    server_name xxx.xx.x.xx;

    location / {
        try_files $uri $uri/ /index.php?$args ;
    }

    # For simpleSAMLphp
    location /simplesaml {
        alias /var/www/sso/html/simplesaml/www;
        location ~ \.php(/|$) {
                fastcgi_split_path_info ^(.+?\.php)(/.+)$;
                fastcgi_param PATH_INFO $fastcgi_path_info;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;
            }  
    }

    error_page 404 /404.html;
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root /usr/share/nginx/html;
    }

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        #fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param SCRIPT_FILENAME $request_filename;
        include fastcgi_params; 
    }   
}   

My file structure is the following, where /var/www/sso/html/ is the root-folder. I have put the SimpleSAMLphp structure in /var/www/sso/html/simplesaml/

I have followed the installation steps found on https://simplesamlphp.org/docs/stable/simplesamlphp-install Although this guide only covers Apache server.

I have investigated how to configure the Nginx server block the right way. But the behaviour I get is that when typing my-domain.com/simplesaml I get redirected to my-domain.com/simplesaml/module.php/core/frontpage_welcome.php With the site outputing No input file specified.

I have then looked in my Nginx error.log which tells me this:

[error] 26283#0: *1 FastCGI sent in stderr: "Unable to open primary script: /var/www/sso/html/simplesaml/www//module.php/core/frontpage_welcome.php (No such file or directory)" while reading response header from upstream, client: xxx.xxx.xx.234, server: xxx.xx.x.xx, request: "GET /simplesaml/module.php/core/frontpage_welcome.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "xxx.xx.x.23"

I then read about the error message and tried to change according to what's stated here: http://blog.martinfjordvald.com/2011/01/no-input-file-specified-with-php-and-nginx/

I have checked the permission for files/directories in my sso directory, after running:

find sso/ -type d -exec chmod 755 {} \;
find sso/ -type f -exec chmod 755 {} \;

It looks like this: enter image description here

Although it all seems right, user group allowed to run/read/write to files. I also changed to fastcgi_param SCRIPT_FILENAME $request_filename; in Nginx server block.

My thoughts

How come it redirects to simplesaml/module.php/core/frontpage_welcome.php and not simplesaml/modules/core/frontpage_welcome.php ?

What could be wrong?

1

3 Answers 3

1

That is normal behaviour for simplesamlphp as far as every installation I have ever done on Apache. I haven't got Nginx working yet, but the idea would be to have it work the same, just to pass the path_info to module.php via php-fpm as a parameter.

0

See this answer. It's saying file not found as it can't resolve the filename of the alias.

https://groups.google.com/forum/#!topic/simplesamlphp/TvU1qZpWBIs

1
  • Welcome to U&L! It's more useful for this site to include the contents of links as answers, as links may become broken.
    – Jeff Schaller
    Jul 6, 2016 at 17:18
0

I know I am late to the game but this may help. I run into similar issues (and others :-( ), what was crucial to make all my pains vanish was the value of baseurlpath in simplesamlphp/config/config.php. What worked for me was using the actual URL, not the *nix path to ../www, i.e. baseurlpath=https://mysiteurl.com/simplesaml/

For ref, here is the relevant piece of the location block within my server block:

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 /absolute_path/to/simplesamlphp/www/;

    # set index document
    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 unix:/var/run/php5-fpm.sock;
        include fastcgi_params;
   }
}

You must log in to answer this question.

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