centos7 - nginx配置access_log问题
问题描述
我想给nginx开启访问日志。百度了一下,主要是在nginx.conf中配置

这一段
# 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;
默认都是加#注释掉的,我想开启,也就是这段都取消#注释了。然后重启nginx却重启不了,提示Job for nginx.service failed because the control process exited with error code. See 'systemctl status nginx.service' and 'journalctl -xe' for details.
把#加回去又没事了,什么原因啊,包括开头的错误日志
#error_log logs/error.log;#error_log logs/error.log notice;#error_log logs/error.log info;
也是把#去掉想生效,结果nginx就启动不了。`
问题解答
回答1:1.请使用 nginx -t 检查配置文件获取 查看具体得错误信息
日志这样处理
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;
相关文章:
1. docker gitlab 如何git clone?2. docker - 各位电脑上有多少个容器啊?容器一多,自己都搞混了,咋办呢?3. dockerfile - 为什么docker容器启动不了?4. nignx - docker内nginx 80端口被占用5. javascript - 修改表单多选项时和后台同事配合的问题。6. javascript - weex和node,js到底是怎样一个关系呢?7. 我在centos容器里安装docker,也就是在容器里安装容器,报错了?8. golang - 用IDE看docker源码时的小问题9. docker安装后出现Cannot connect to the Docker daemon.10. redis - 究竟是选择微信小程序自带的统计工具还是自己开发一个数据统计的代码?

网公网安备