log_format directive may be used only on http level
来源:互联网 发布:游戏编程入门pdf 编辑:程序博客网 时间:2024/05/17 23:40
nginx 日志出错信息 :nginx: [warn] the "log_format" directive may be used only on "http" level一般来说如果nginx的版本...
nginx 日志出错信息 :
nginx: [warn] the "log_format" directive may be used only on "http" level
一般来说如果nginx的版本在1以下,那么不会出错。
对于nginx的新版本,比如1.1.15 ,会出这样的问题,nginx的配置规则有更新,这句话的警告意思是log_format 只能用在 http这个标签中,但是多数情况下,我们有可能在nginx.conf 中include 一个配置文件,在include的配置文件中如果把log_format 放到server 段里,就会出问题,这个在老版本的nginx的语法检查中是不会出错的。
那么好,就把log_format 放到 server 段的前面吧,像这样:
nginx.conf:
include little.conf
---------------------------------------------------------------------------------------------------------------------------------------------------
little.conf:
log_format access '$http_x_forwarded_for $remote_user [$time_local] "http://$host" "$request" '
'$status $body_bytes_sent "$http_referer" "$http_user_agent" "$HTTP_X_UP_CALLING_LINE_ID" ';
access_log /usr/local/nginx/logs/access.log access;
server
{
listen 80;
server_name xxx.com;
.....................
[root@t1 ~]# /usr/local/nginx/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@t1 ~]#
参考:
http://www.a8z8.com/html/2012/tech_1117/46.html
http://www.baibaobing.com/linux/6.html/comment-page-75
http://xiahongyuan.blog.51cto.com/906214/852607
0 0
- log_format directive may be used only on http level
- a pointer to a bound function may only be used to call the function
- a pointer to a bound function may only be used to call the function
- 编译报错“a pointer to a bound function may only be used to call the function”的解决办法
- android R.java居然报错,Underscores can only be used with source level 1.7 or greater
- Only MySqlParameter objects may be stored
- BulkWrite objects may only be executed once
- ORA-39181: Only partial table data may be exported due to fine grain access control on "OE"."PURCHAS
- enum should not be used as an identifier since it is a reserved keyword from source level 1.5 on
- The following types may not be used as proxies 异常
- The following types may not be used as proxies
- Compilation Error:function 'NAME_IN' may not be used in SQL
- warning: ‘p’ may be used uninitialized in this function
- " 'this' may not be used in this context"
- Instance member cannot be used on type
- warning: operation on ‘i’ may be undefined
- java.lang.IllegalArgumentException: FormUrlEncoded can only be specified on HTTP methods with requ
- 转载-SMTPTimeoutMultiplier should only be used with great care
- [Canvas绘图] 第31节 藏图阁(11) AlphaGo与李世石的围棋大战之第一局
- js中URL中带有空格参数的处理方法
- Git问题Everything up-to-date解决__提交代码遇到『Everything up-to-date』
- Computing image mean... ./examples/cifar10/create_cifar10.sh: 16: ./examples 怎么回事
- KNN算法
- log_format directive may be used only on http level
- 分布式服务框架的4项特性
- 礼拜一log~tag lib标签 & java ArrayList去重方式 & Mac本下对类声明的查询方法
- Failed to load the LayoutLib: com/android/layoutlib/bridge/Bridge : Unsupported major.minor version
- U盘安装Centos拔除U盘后无法启动问题解决
- 这些cuda资料要学会总结
- 不注意七大问题,简历最容易没回音
- DB理论--数据存储方式
- C#笔试题(一)