Article From:

I want to open access log for nginx. Baidu, which is mainly configured in nginx.conf.

This paragraph

#    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
#                      '$status $body_bytes_sent "$http_referer" '
#                      '"$http_user_agent" "$http_x_forwarded_for"';
#    access_log  logs/access.log  main;

The default is all annotated, and I want to open it, that is to say, this paragraph cancels the comment.
Then restart nginx, but not restart.
Job for nginx.service failed because the control process exited with error code. See “systemctl status nginx.service” and “journalctl -xe” for details.

It’s all right to add it back. What’s the reason?
Including the beginning of the error log

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

It’s also a way to get rid of it, so that nginx will not start.

Answer 0:

1.Please use itnginx -t Check configuration files to get specific error messages.

Log processing

   log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                     '$status $body_bytes_sent "$http_referer" '
                     '"$http_user_agent" "$http_x_forwarded_for"';

   access_log  logs/access.log  main;

Leave a Reply

Your email address will not be published. Required fields are marked *