SimpleSAMLphp, Nginx, Ubuntu 14.04

SimpleSAMLphp, Nginx, Ubuntu 14.04

私の設定

  • Ubuntu 14.04 LTS 64ビット
  • nginx
  • SimpleSAMLphp 1.13.2

私のNginxサーバーブロック:

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

私のファイル構造は次のとおりです/var/www/sso/html/。ルートフォルダはどこにありますか? SimpleSAMLphp構造/var/www/sso/html/simplesaml/

私はの取付けのステップに続きました。https://simplesamlphp.org/docs/stable/simplesamlphp-installこのガイドでは、Apacheサーバーのみを扱っています。

Nginxサーバーブロックを正しく設定する方法を研究しました。しかし、私が得る行動はタイプする時です。my-domain.com/simplesaml私は次にリダイレクトされました。my-domain.com/simplesaml/module.php/core/frontpage_welcome.phpウェブサイトの出力へどの入力ファイルも指定しません。

その後、Nginx error.logを見て、次のように言いました。

[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"

その後、エラーメッセージを読み、ここで説明したように変更しようとしました。http://blog.martinfjordvald.com/2011/01/no-input-file-specified-with-php-and-nginx/

実行後、ssoディレクトリにあるファイル/ディレクトリの権限を確認しました。

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

次のようになります。 ここに画像の説明を入力してください。

すべてが正しく表示されますが、ユーザーグループはファイルの実行/読み取り/書き込みを許可します。また、fastcgi_param SCRIPT_FILENAME $request_filename;Nginxサーバーブロックに変更しました。

私の考え

simplesaml/modules/core/frontpage_welcome.phpの代わりにsimplesaml/module.php/core/frontpage_welcome.phpにリダイレクトされるのはなぜですか?

何が間違っている可能性がありますか?

ベストアンサー1

これは、Apacheによって実行されたすべてのインストールにおけるsimplesamlphpの一般的な動作です。まだNginxを動作させていませんが、php-fpmを介してmodule.phpにパラメータとしてpath_infoを渡して同じように動作させるのがアイデアです。

おすすめ記事