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. mysql優化 - mysql count(id)查詢速度如何優化?2. angular.js - 不適用其他構建工具,怎么搭建angular1項目3. mysql主從 - 請教下mysql 主動-被動模式的雙主配置 和 主從配置在應用上有什么區別?4. python - django 里自定義的 login 方法,如何使用 login_required()5. 主從備份 - 跪求mysql 高可用主從方案6. java8中,邏輯與 & 符號用在接口類上代表什么意思7. python如何不改動文件的情況下修改文件的 修改日期8. angular.js - angular-ui-bootstrap 報錯無法使用?9. node.js - node_moduls太多了10. python - 關于ACK標志位的TCP端口掃描的疑惑?
