nginx: [warn] the "log_format" directive may be used only on "http" level 解決方法
一直不提倡使用最新的版本,不過也真因?yàn)橛胁糠謵壅垓v的才會(huì)不斷的發(fā)現(xiàn)問題。目前Nginx的穩(wěn)定版本是1.0.12,Nginx升級(jí)到1.1.1*版本后,會(huì)出現(xiàn)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';
如果有其的虛擬主機(jī)開啟了日志,也按上面的要求移出server段放在server段的前面即可。
再/usr/local/nginx/sbin/nginx -t 測(cè)試一下,沒有warn警告信息了。
總之,生產(chǎn)環(huán)境升級(jí)需謹(jǐn)慎。
>>轉(zhuǎn)載請(qǐng)注明出處:VPS偵探 本文鏈接地址:http://www.0794baidu.com/manage/nginx-warn-the-log_format-directive-may-be-used-only-on-http-level.html










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