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. ueditor上传服务器提示后端配置项没有正常加载,求助!!!!!2. 配置文件 - nginx多站点配置,无法通过域名访问,使用ip访问会跳转到其中一个站点3. css - transform: translateY(-50%)在360浏览器极速模式下使得文字变模糊了4. css - .clearfix:after中为什么设置display: table5. angular.js - 怎样在使用ng-repeat属性的标签里面监听单个事件,使其能够单个改变CSS。6. 请教: 关于 python 反斜杠转义的疑问7. python - 关于matplotlib的x轴显示的问题8. javascript - vue生成一维码?求助!!!!!急9. mysql优化 - mysql慢查询copying to tmp table10. nginx英文文档的WebSocket proxying部分没看太明白,麻烦推荐一点中文文章
