2016-11-11 11 views
0

CentOS 7.xでAWS EC2(c3.xlarge)インスタンスを使用しています。これらは私のマウントポイントです:Amazon EC2インスタンスのCentOS 7でPermissionが拒否されました(起動時)

[[email protected] ~]$ df -h 
Filesystem  Size Used Avail Use% Mounted on 
/dev/xvda1  8.0G 1.5G 6.6G 18%/
devtmpfs  3.6G  0 3.6G 0% /dev 
tmpfs   3.5G  0 3.5G 0% /dev/shm 
tmpfs   3.5G 17M 3.5G 1% /run 
tmpfs   3.5G  0 3.5G 0% /sys/fs/cgroup 
/dev/xvdb  40G 49M 38G 1% /mnt 
tmpfs   707M  0 707M 0% /run/user/1000 

ルートパーティション/は(OS用)8ギガバイトであると私は、ウェブサイトのファイルに対して/mntに取り付けられた40ギガバイトのドライブを持っています。これは標準的な設定です。

sudo su -を使用して)rootとしてログインし、/mntの所有権をcentos:centos(デフォルトのログインアカウント)に変更しました。

このディレクトリには、すべてのエラーログを格納する別のディレクトリがあります。/mnt/errors(dir permは755です)。 nginxのはnginx.confインストールされた

は、次の行があります

user    centos; 
worker_processes 4; 
error_log  /mnt/errors/nginx-errors.log crit; 
pid    /var/run/nginx.pid; 

私は、このコマンドを使用して、nginxのサーバー起動時:

[[email protected] ~]$ sudo systemctl status nginx 
â— nginx.service - nginx - high performance web server 
    Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled) 
    Active: failed (Result: exit-code) since Fri 2016-11-11 02:20:14 UTC; 7min ago 
    Docs: http://nginx.org/en/docs/ 
    Process: 10394 ExecStartPre=/usr/sbin/nginx -t -c /etc/nginx/nginx.conf (code=exited, status=1/FAILURE) 

Nov 11 02:20:14 ip-10-0-4-119.localdomain systemd[1]: Starting nginx - high performance web server... 
Nov 11 02:20:14 ip-10-0-4-119.localdomain nginx[10394]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok 
Nov 11 02:20:14 ip-10-0-4-119.localdomain nginx[10394]: nginx: [emerg] open() "/mnt/errors/nginx-errors.log" failed (13: Permission denied) 
Nov 11 02:20:14 ip-10-0-4-119.localdomain nginx[10394]: nginx: configuration file /etc/nginx/nginx.conf test failed 
Nov 11 02:20:14 ip-10-0-4-119.localdomain systemd[1]: nginx.service: control process exited, code=exited status=1 
Nov 11 02:20:14 ip-10-0-4-119.localdomain systemd[1]: Failed to start nginx - high performance web server. 
Nov 11 02:20:14 ip-10-0-4-119.localdomain systemd[1]: Unit nginx.service entered failed state. 
Nov 11 02:20:14 ip-10-0-4-119.localdomain systemd[1]: nginx.service failed. 
は、私は次のエラーを取得 nginx.service開始systemctlを

nginxエラーを保存するためにカスタムロケーションを使用できないのはなぜですか?

答えて

0

ログが保存されるディレクトリは、nginxワーカープロセスの所有者になるので、nginxユーザーが読み取り、書き込み、実行可能であることを確認してください。それは理にかなっていない場合、あなたはこれを行うことができ

[[email protected] opt]# ls -ld /var/log/nginx/ 
drwx------ 2 nginx nginx 4096 Nov 11 03:27 /var/log/nginx/ 

:ここに私のnginxのログディレクトリは次のようになります ます。chmod -R 755/mntに/エラー のchown -R nginxの:nginxのを/ mnt /エラー

HTH

関連する問題