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. python - oslo_config2. python - 如何統計一份英文 API 開發文檔(如 javadoc文檔)的詞頻?3. mysql優化 - mysql 一張表如果不能確保字段列長度一致,是不是就不需要用到char。4. python - 請問這兩個地方是為什么呢?5. python - 為什么match匹配出來的結果是<_sre.SRE_Match object; span=(0, 54), match=’’>6. 請教一個mysql去重取最新記錄7. javascript - 按鈕鏈接到另一個網址 怎么通過百度統計計算按鈕的點擊數量8. 人工智能 - python 機器學習 醫療數據 怎么學9. 大家都用什么工具管理mysql數據庫?10. php - 有關sql語句反向LIKE的處理
