Nginx错误日志配置
2015-10-14 13:11
501 查看
Nginx作为代理服务器的功能,可以为网站访问时配置访问日志和错误日志。
1.在配置Nginx的访问日志之前,需要先在http配置将 access_log 开启
2.在sever的配置中对错误日进行配置。如下:
server {
access_log /cjzc/cjzcaccess.log;
error_log /cjzc/cjzcerror.log; debug(表示错误的级别)
#other config
}
error_log的错误级别有:debug,info,notice,warn,error,crit。其中crit记录的日志最少,而debug记录的日志的最多。
3.Nginx的Location指定错误日志
为了调试一个应用的部分,可以在一个或是多个location{..}中指定error_log指令。如下:
server{
error_log /cjzc/logs/cjzcaccess.log;
location /admin/ {
error_log /cjzc/logs/adminerror.log
}
#other config
}
以上将仅仅调试应用程序下面的admin的错误信息,同时会将错误信息写入到adminerror.log日志中。
1.在配置Nginx的访问日志之前,需要先在http配置将 access_log 开启
2.在sever的配置中对错误日进行配置。如下:
server {
access_log /cjzc/cjzcaccess.log;
error_log /cjzc/cjzcerror.log; debug(表示错误的级别)
#other config
}
error_log的错误级别有:debug,info,notice,warn,error,crit。其中crit记录的日志最少,而debug记录的日志的最多。
3.Nginx的Location指定错误日志
为了调试一个应用的部分,可以在一个或是多个location{..}中指定error_log指令。如下:
server{
error_log /cjzc/logs/cjzcaccess.log;
location /admin/ {
error_log /cjzc/logs/adminerror.log
}
#other config
}
以上将仅仅调试应用程序下面的admin的错误信息,同时会将错误信息写入到adminerror.log日志中。
相关文章推荐
- nginx 集群配置方式 静态文件处理
- Nginx - rewrite 不区分大小写进行匹配
- 精通Nginx应用篇之配置与Location详解
- Nginx_cache缓存部署
- nginx 学习笔记【持续更新...】
- nginx 负载均衡web查看状态nginx_upstream_check_module
- 【nginx运维基础(3)】Nginx的编译PHP
- nginx+uwsgi+django+python 应用架构部署
- yaf的nginx的rewrite
- Nginx负载均衡器让后端RS记录真实IP
- CenOS Linux安装nginx
- nginx: [alert] kill(2480, 10) failed (3: No such process)的解决办法及nginx服务常用命令总结
- keepalived+nginx的代理使用心得
- nginx配置
- nginx配置为系统服务
- 软件级负载均衡器(LVS/HAProxy/Nginx)的特点和对比
- nginx配置学习-nginx控制
- Nginx负载均衡配置实例详解
- Debian 7设备nginx周围环境、编译并安装和启动
- nginx后端服务健康检测