nginxは、ルートとすべてのファイルに属するディレクトリのサイトをどのように提供しますか?

nginxは、ルートとすべてのファイルに属するディレクトリのサイトをどのように提供しますか?

私の一部/etc/nginx/nginx.conf

    #user nobody;
    user http;

    worker_processes  1;

    events {
        worker_connections 1024;
    }

    #.......

私のウェブサイトの一つ:

ls -al /var/web/site123.com/index.html 
-rw-r--r-- 1 root root 761 Jul  3 07:31 /var/web/site123.com/index.html


ls -ald /var/web/site123.com
drwxr-xr-x 2 root root 4096 Jul  3 07:31 /var/web/site123.com

ウェブサイトのディレクトリもindex.html属している場合、rootnginxはどのようにウェブサイトを操作して提供しますか? nginxワーカーはユーザーの下で実行され、httpWebサイトはインターネット経由でアクセスできます。

root      873848  0.0  0.0  22392  1436 ?        Ss   07:27   0:00 nginx: master process /usr/bin/nginx -g pid /run/nginx.pid; error_log stderr;
http      873849  0.0  0.2  22396  4264 ?        S    07:27   0:00 nginx: worker process

アクセスのみを許可する必要があるこのユーザーhttpアクセスパスはどうなりますか?root

ベストアンサー1

ディレクトリ権限を確認してください。

lsコマンドの出力に見られるように

ls -al /var/web/site123.com/index.html 
-rw-r--r-- 1 root root 761 Jul  3 07:31 /var/web/site123.com/index.html


ls -ald /var/web/site123.com
drwxr-xr-x 2 root root 4096 Jul  3 07:31 /var/web/site123.com

すべての人に読み取り/実行権限755を付与し、index.htmlの場合、すべての人に読み取り権限を付与したため、誰でもディレクトリにアクセスできます。

おすすめ記事