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;
也是把#去掉想生效,結(jié)果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;
相關(guān)文章:
1. Python從URL中提取域名2. php傳對應的id值為什么傳不了啊有木有大神會的看我下方截圖3. python - scrapy url去重4. python - Flask寫的注冊頁面,當注冊時,如果填寫數(shù)據(jù)庫里有的相同數(shù)據(jù),就報錯5. 關(guān)于mysql聯(lián)合查詢一對多的顯示結(jié)果問題6. 實現(xiàn)bing搜索工具urlAPI提交7. 數(shù)據(jù)庫 - Mysql的存儲過程真的是個坑!求助下面的存儲過程哪里錯啦,實在是找不到哪里的問題了。8. python - oslo_config9. MySQL主鍵沖突時的更新操作和替換操作在功能上有什么差別(如圖)10. 小白學python的問題 關(guān)于%d和%s的區(qū)別
