tryとindexのNginxパーミッションエラー(実際のファイルは問題なく動作します)


0

私のMacには、Homebrew経由でnginxがインストールされています。私は最近仮想PHPサーバーを追加しようとしました。正しいファイル名にアクセスしても問題なく動作しますが、tryブロックが呼び出されたりインデックスファイルが提供されたりすると、アクセス権エラーが発生します。

#200 :
http://php-sandbox.dev/index.php
#404 :
http://php-sandbox.dev/index
http://php-sandbox.dev/

ファイルindex.phpはルートWebディレクトリに存在し、パス内のすべてのフォルダと同様に744の権限を持っています。

indexディレクティブは明らかに無視されています。下記の例とエラー、および私のnginx設定を参照してください。

nginx用のサイト設定ファイル:     サーバー{         80を聞きます。         聞く[::]:80;         error_log /var/log/nginx/php-sandbox/error.log debug;         rewrite_log on;

    server_name php-sandbox.dev;

    root        /Users/sswright/repos/jswright61/php-sandbox/public;
    index       index.php index.html;

    include drop.conf; #ignores favicons

    location / {
        try_files $uri $uri.php $uri/ =404;
    }

    location ~ \.php$ {
            fastcgi_split_path_info ^(.+\.php)(.*)$;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
            fastcgi_pass 127.0.0.1:9000;
    }
}

エラーログ:( /要求)

2017/04/23 09:47:15 [crit] 11149#0: *9 stat() "/Users/sswright/repos/jswright61/php-sandbox/public/" failed (13: Permission denied), client: 127.0.0.1, server: php-sandbox.dev, request: "GET / HTTP/1.1", host: "php-sandbox.dev"
2017/04/23 09:47:15 [crit] 11149#0: *9 stat() "/Users/sswright/repos/jswright61/php-sandbox/public/.php" failed (13: Permission denied), client: 127.0.0.1, server: php-sandbox.dev, request: "GET / HTTP/1.1", host: "php-sandbox.dev"
2017/04/23 09:47:15 [crit] 11149#0: *9 stat() "/Users/sswright/repos/jswright61/php-sandbox/public/" failed (13: Permission denied), client: 127.0.0.1, server: php-sandbox.dev, request: "GET / HTTP/1.1", host: "php-sandbox.dev"

tryブロックは実行中ですが、インデックスは試行されていません。

エラーログ:( /インデックス要求)

2017/04/23 10:11:40 [crit] 11149#0: *12 stat() "/Users/sswright/repos/jswright61/php-sandbox/public/index" failed (13: Permission denied), client: 127.0.0.1, server: php-sandbox.dev, request: "GET /index HTTP/1.1", host: "php-sandbox.dev"
2017/04/23 10:11:40 [crit] 11149#0: *12 stat() "/Users/sswright/repos/jswright61/php-sandbox/public/index.php" failed (13: Permission denied), client: 127.0.0.1, server: php-sandbox.dev, request: "GET /index HTTP/1.1", host: "php-sandbox.dev"
2017/04/23 10:11:40 [crit] 11149#0: *12 stat() "/Users/sswright/repos/jswright61/php-sandbox/public/index" failed (13: Permission denied), client: 127.0.0.1, server: php-sandbox.dev, request: "GET /index HTTP/1.1", host: "php-sandbox.dev"

ここではindex.phpを探していますが、パーミッションエラーが発生しています。 /index.phpが要求されると、ページは正しくロードされます。


URI /index ダウンロードさせるはずです index.php。これは現在のものですか? nginx 構成?を使ってテストする nginx -T
Richard Smith

はい、現在の設定がアクティブであることを確認しました。nginx-tを実行しても成功します。
Scott
弊社のサイトを使用することにより、あなたは弊社のクッキーポリシーおよびプライバシーポリシーを読み、理解したものとみなされます。
Licensed under cc by-sa 3.0 with attribution required.