/var/log/nginx というディレクトリを使用したくないんです!
nginx.org
ここにあるとおり、syslogに飛ばすには syslogサーバなりUNIXドメインソケットなりを指定する。
もっとも簡単なパターンは次の通り
http {
(中略)
access_log syslog:server=unix:/dev/log;
error_log syslog:server=unix:/dev/log;
これだと、nginx自体のエラーログのために /var/log/nginx/error.log が必要なまま。
そこで、さらに全体のログ出力先を指定する
error_log off;
http {
(中略)
access_log syslog:server=unix:/dev/log;
error_log syslog:server=unix:/dev/log;
全体のエラーログをオフにしても /dev/null に飛ばしても、syslogには systemdのログとしてエラーが残るので大丈夫
この状態でも、設定ファイルチェックではまだエラーが出るけど、一応OKになるのでそんなに気にしなくて良い
# nginx -t
nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (2: No such file or directory)
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful