Nginx 错误日志配置

错误日志可以在 nginx.conf 的全局配置(也就是main区块)中添加,也可以在不同虚拟主机配置文件中的全局配置中单独添加

语法:error_log  file  level;  // error_log 是固定的关键字,file 是错误日志的存放路径,level 是日志等级

配置实例:

worker_processes  1;
user nobody nobody;
pid /usr/local/nginx/nginx.pid;error_log logs/error.log error;  //默认就是这样配置,所以不配置错误日志记录也可以,只有当有需求的时候才配置

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    server {
        listen       80;
        server_name  www.xxxxx.com;
        location / {
            root   html/www;
            index  index.html index.htm;
        }
    }
}     
时间: 2024-08-10 13:50:07

Nginx 错误日志配置的相关文章

Nginx错误日志整理

Nginx错误日志说明 错误日志类型 类型1: upstream timed out 类型2: connect() failed 类型3: no live upstreams 类型4: upstream prematurely closed connection 类型5: 104: Connection reset by peer 类型6: client intended to send too large body 类型7: upstream sent no valid HTTP/1.0 he

Nginx错误日志(error_log)配置及信息详解

Nginx状态信息(status)配置及信息详解 nginx与php-fpm一样内建了一个状态页,对于想了解nginx的状态以及监控nginx非常有帮助.为了后续的zabbix监控,我们需要先了解一下nginx的状态页. Nginx状态信息(status)介绍 Nginx软件在编译时又一个with-http_stub_status_module模块,这个模块功能是记录Nginx的基本访问状态信息,让使用者了解Nginx的工作状态.要想使用状态模块,在编译时必须增加--with-http_stub

Nginx错误日志说明

错误日志类型 类型1: upstream timed out 类型2: connect() failed 类型3: no live upstreams 类型4: upstream prematurely closed connection 类型5: 104: Connection reset by peer 类型6: client intended to send too large body 类型7: upstream sent no valid HTTP/1.0 header 详细说明 类型

nginx错误日志error_log日志级别

在配置nginx.conf 的时候,有一项是指定错误日志的,默认情况下你不指定也没有关系,因为nginx很少有错误日志记录的.但有时出现问题时,是有必要记录一下错误日志的,方便我们排查问题.error_log 级别分为 debug, info, notice, warn, error, crit  默认为crit, 该级别在日志名后边定义格式如下:error_log  /your/path/error.log crit;  crit 记录的日志最少,而debug记录的日志最多.如果你的nginx

nginx网站日志配置

用yum安装的nginx的日志默认安装在路径:/var/log/nginx nginx配置文件:/etc/nginx/nginx.conf (总配置文件)/etc/nginx/conf.d/default.conf (网站级别的配置文件) 如果要使用nginx默认配置的日志格式,并改变日志的存储位置,可以在/etc/nginx/conf.d/default.conf 的server中直接添加日志文件的路径:access_log /root/ss/log/ss-access.logerror_lo

nginx错误日志级别

在配置nginx.conf 的时候,有一项是指定错误日志的,默认情况下你不指定也没有关系,因为nginx很少有错误日志记录的.但有时出现问题时,是有必要记录一下错误日志的,方便我们排查问题.error_log 级别分为 debug, info, notice, warn, error, crit  默认为crit, 该级别在日志名后边定义格式如下:error_log  /your/path/error.log crit;  crit 记录的日志最少,而debug记录的日志最多.如果你的nginx

nginx访问日志配置+日志切割+不记录静态文件日志+设置静态文件过期时间

nginx访问日志 查看nginx.conf文件 vim /usr/local/nginx/conf/nginx.conf 中间有一行是定义log的格式 log_format combined_realip '$remote_addr $http_x_forwarded_for [$time_local]' ' $host "$request_uri" $status' ' "$http_referer" "$http_user_agent"';

logstash 2.2以上版本,nginx 错误日志切割

网上nginx错误日期切分的版本各式各样,能用的没几个,踩过很多坑,特意记录下: if [type] == "xx_app_nginx_error_log" { grok { patterns_dir => "/etc/logstash/conf.d/patterns" match => { "message" => "%{NGINXERROR_1}" } } mutate { #避免日期报错 gsub =&

Nginx 访问日志配置

Nginx 会把每个用户访问网站的日志信息记录到指定的日志文件里,此功能由 ngx_http_log_module 日志模块负责. 语法: log_format name string ...; //定义日志格式,log_format是固定关键字,name是日志格式的名字,string是日志变量 access_log file name; //应用日志格式,access_log是固定关键字,file是存放日志的路径,name是应用哪个名字的日志格式 日志变量: $remote_addr :记录访