揮発性のメモ2

知識をメモ書きしておく

nginx -t で設定ファイルのチェックがエラーになる

nginx -t を一般ユーザで実行してるのが原因。 rootで実行すればOK

$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful


一般人でテストするとこうなる

$ nginx -t
nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)
2038/07/01 11:24:00 [warn] 1129#1129: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:5
2038/07/01 11:24:00 [emerg] 1129#1129: cannot load certificate key "/etc/pki/nginx/test.key": BIO_new_file() failed (SSL: error:8000000D:system library::Permission denied:calling fopen(/etc/pki/nginx/test.key, r) error:10080002:BIO routines::system lib)
nginx: configuration file /etc/nginx/nginx.conf test failed


/etc/pki/nginx/test.key が読めませんというエラーで、一般人は読めないので当然のエラー

# ls -l /etc/pki/nginx/
合計 8
-rw-r--r--. 1 root root 1115  417 16:35 test.crt
-rw-------. 1 root root 1704  417 16:35 test.key