打开Nginx的debug选项

通常情况下,Nginx 的错误日志级别是 error,对于Nginx 用户来说,将日志设置为info级别就足够用了。对于比较复杂的情况,需要看到更详细的 debug 级别的日志,如果只是把error_log级别设置为debug,Nginx 记录下来的还是info级别以上的信息。只有激活 Nginx的 debug日志才能得到 debug级别的日志信息。下面记录添加debug错误日志的过程。

#查看当前编译选项

[root@username sbin]# ./nginx -V
nginx version: nginx/1.10.3
built by gcc 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC) 
configure arguments: --prefix=/deploy/nginx

#上传Nginx原生文件

scp /Users/username/Downloads/nginx-1.12.0.tar.gz dfecmes/dfecmes@192.168.1.133:/software

#解压

tar -xzvf nginx-1.12.0.tar.gz
cd nginx-1.12.0

#设置编译选项

./configure --prefix=/software/nginx-debug --with-debug

执行以上命令时出现如下错误:

./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.

解决办法,安装pcre-devel:

yum -y install pcre-devel

结果如下:

[root@test1 software]# yum -y install pcre-devel
已加载插件:fastestmirror, langpacks
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
base                                                                                                                                                                                        | 3.6 kB  00:00:00     
extras                                                                                                                                                                                      | 3.4 kB  00:00:00     
updates                                                                                                                                                                                     | 3.4 kB  00:00:00     
(1/2): extras/7/x86_64/primary_db                                                                                                                                                           | 167 kB  00:00:00     
(2/2): updates/7/x86_64/primary_db                                                                                                                                                          | 5.6 MB  00:00:02     
Loading mirror speeds from cached hostfile
 * base: mirrors.btte.net
 * extras: mirrors.neusoft.edu.cn
 * updates: mirrors.neusoft.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 pcre-devel.x86_64.0.8.32-15.el7_2.1 将被安装
--> 解决依赖关系完成

依赖关系解决

===================================================================================================================================================================================================================
 Package                                             架构                                            版本                                                      源                                             大小
===================================================================================================================================================================================================================
正在安装:
 pcre-devel                                          x86_64                                          8.32-15.el7_2.1                                           base                                          479 k

事务概要
===================================================================================================================================================================================================================
安装  1 软件包

总下载量:479 k
安装大小:1.4 M
Downloading packages:
pcre-devel-8.32-15.el7_2.1.x86_64.rpm                                                                                                                                                       | 479 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : pcre-devel-8.32-15.el7_2.1.x86_64                                                                                                                                                              1/1 
  验证中      : pcre-devel-8.32-15.el7_2.1.x86_64                                                                                                                                                              1/1 

已安装:
  pcre-devel.x86_64 0:8.32-15.el7_2.1                                                                                                                                                                              
完毕!

#编译源代码并安装

make
make install

然后可以通过 error_log 指令设置 debug 级别:

error_log /path/to/log debug;

转载于:https://my.oschina.net/hahaduo/blog/911790

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值