私のコンテンツは次のとおりですls -al /etc/nginx
。
total 52
drwxr-xr-x. 4 root root 4096 Jul 28 04:16 .
drwxr-xr-x. 78 root root 8192 Jul 28 03:37 ..
drwxr-xr-x. 2 root root 26 Jul 28 03:55 conf.d
drwxr-xr-x. 2 root root 6 May 10 09:21 default.d
-rw-r--r--. 1 root root 1034 May 10 09:21 fastcgi.conf
-rw-r--r--. 1 root root 964 May 10 09:21 fastcgi_params
-rw-r--r--. 1 root root 2837 May 10 09:21 koi-utf
-rw-r--r--. 1 root root 2223 May 10 09:21 koi-win
-rw-r--r--. 1 root root 3957 May 10 09:21 mime.types
-rw-r--r--. 1 root root 1033 Jul 28 03:43 nginx.conf
-rw-r--r--. 1 root root 596 May 10 09:21 scgi_params
-rw-r--r--. 1 root root 623 May 10 09:21 uwsgi_params
-rw-r--r--. 1 root root 3610 May 10 09:21 win-utf
/var/log/nginx/error.log
後で見た内容は次のとおりですsudo service nginx start
。
[emerg] 20360#0: open() "/etc/nginx/conf.d/foo.conf" failed
(13: Permission denied) in /etc/nginx/nginx.conf:33
これが私が持っているものですls -al /etc/nginx/conf.d/
:
$ ls -al /etc/nginx/conf.d/
total 8
drwxr-xr-x. 2 root root 26 Jul 28 03:55 .
drwxr-xr-x. 4 root root 4096 Jul 28 04:16 ..
-rw-r--r--. 1 root root 230 Jul 28 03:50 foo.conf
何が問題なの?
ベストアンサー1
不明な理由でファイルアクセスなどでエラーが発生した場合は、permission denied
SELinuxと関連がある可能性があります。特に、権限の後にピリオドがある場合(関連ファイル/ディレクトリ内)、drwxr-xr-x.
ラベルが誤って指定されて問題が発生する可能性があります。ls -l
ls -Z
まず、を実行して現在のSELinuxモードを確認する必要がありますgetenforce
。表示されたら、Enforcing
一時的にモードをPermissive
実行に設定し、setenforce 0
アプリケーションが動作していることを確認してください。
起動時の SELinux モードの設定、ファイルまたはディレクトリのラベルの上書き、ポリシーの更新などを含む永続的な修正については、ディストリビューションの SELinux ガイドラインを参照してください。CentOSガイド。