nginx: [warn] the “log_format” directive may be used only on “http” level ...解决办法

新开了一个vps,装了最新的nginx 1.0.2版本,将原来的虚拟主机配置直接拿过来.用nginx -t 测试语法的时候,发现提示以下警告信息

[root@centos nginx]# ./sbin/nginx -t
nginx: [warn] the “log_format” directive may be used only on “http” level in /usr/local/nginx/conf/vhosts/bbs.conf:62

解决办法如下:

将/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警告信息了。

[root@centos vhosts]# ../../sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@centos vhosts]#

32 thoughts on “nginx: [warn] the “log_format” directive may be used only on “http” level ...解决办法

  1. Pingback: http://edukacjapoliceum.pl/wiesz-co-jesz-2728.php

  2. Pingback: Mazlo

  3. Pingback: w88

  4. Pingback: p4551#blog o marketingu

  5. Pingback: 바카라

  6. Pingback: +18

  7. Pingback: dang ky m88.com

  8. Pingback: satta king

  9. Pingback: pest control

  10. Pingback: 카지노사이트

  11. Pingback: https://pracabiznes.com.pl/forum/

  12. Pingback: Best CBD Oil Companies

  13. Pingback: Kampala International University

  14. Pingback: commercial grow room design

  15. Pingback: https://funkymedia.pl/faq

  16. Pingback: Phim 18+ Han Quoc

  17. Pingback: satta king

  18. Pingback: https://przedszkolelidzbark.pl/

  19. Pingback: Chinese traditional religion

  20. Pingback: buy injectable steroids online

  21. Pingback: sbobet

  22. Pingback: yourfishguide.com mahi mahi fish

  23. Pingback: 7lab pharma trenbolone 200

  24. Pingback: Types Of Fishing Poles

  25. Pingback: guaranteed ppc

  26. Pingback: copy best quality replika panerai

  27. Pingback: 7lab pharma steroids review

  28. Pingback: 먹튀인

  29. Pingback: replicas rolex imitation watches paypal

  30. Pingback: Idgod

  31. Pingback: hondaqq

  32. Pingback: คอนโดเงินเหลือ

Comments are closed.