nginx: [warn] the "log_format" directive may be used only on "http" level 解決方法
一直不提倡使用最新的版本,不過也真因為有部分愛折騰的才會不斷的發現問題。目前Nginx的穩定版本是1.0.12,Nginx升級到1.1.1*版本后,會出現nginx: [warn] the "log_format" directive may be used only on "http" level in /usr/local/nginx/conf/nginx.conf:84的警告。
將/usr/local/nginx/conf/nginx.conf 里server段里的下面代碼移出放到該server段的前面即可。
log_format? access? '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';
如果有其的虛擬主機開啟了日志,也按上面的要求移出server段放在server段的前面即可。
再/usr/local/nginx/sbin/nginx -t 測試一下,沒有warn警告信息了。
總之,生產環境升級需謹慎。
>>轉載請注明出處:VPS偵探 本文鏈接地址:http://m.0794baidu.com/manage/nginx-warn-the-log_format-directive-may-be-used-only-on-http-level.html










遇到這個問題了,已經解決。
@你好, 按官網http://lnmp.org/install.html 上安裝失敗時的處理方法到論壇反饋。
你好 我安裝了最新的lnmp。 網站出現502 怎么辦
果斷退回1.0.12 穩定版的足夠用了
沒遇到過這問題!
升級到1.0.12會出問題不?