centos7 - nginx設定access_log問題
为情所困
为情所困 2017-05-27 17:44:58
0
1
748

我想給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;
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!