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. javascript - iframe 為什么加載網頁的時候滾動條這樣顯示?2. macos - mac下docker如何設置代理3. dockerfile - 我用docker build的時候出現下邊問題 麻煩幫我看一下4. angular.js - angularjs的自定義過濾器如何給文字加顏色?5. dockerfile - 為什么docker容器啟動不了?6. 新手 - Python 爬蟲 問題 求助7. javascript - es6中this8. javascript - 移動端,當出現遮罩層的時候,遮罩層里有div是超出高度scroll的,怎么避免滑動div的時候,body跟隨滑動?9. javascript - ejs支持if else語法嗎10. javascript - web網頁版app返回上一頁按鈕在ios設備失效怎么辦?安卓上可以,代碼如下,請大神幫助,萬分感謝。
