Nginx日志格式设置
来源:互联网 发布:群晖ds file windows 编辑:程序博客网 时间:2024/06/15 18:23
nginx服务器日志相关指令主要有两条,一条是log_format
,用来设置日志格式,另外一条是access_log
,用来指定日志文件的存放路径、格式和缓存大小,一般在nginx的配置文件中日记配置(/usr/local/nginx/conf/nginx.conf
)。
nginx的log_format
有很多可选的参数用于指示服务器的活动状态,默认的是:
log_format access '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"';
- 1
- 2
- 3
- 1
- 2
- 3
想要记录更详细的信息需要自己设置log_format,具体可设置的参数格式及说明如下:
举例说明如下:
1、配置文件
#vim /usr/local/nginx/conf/nginx.conflog_format access '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" $http_x_forwarded_for ' '"$upstream_addr" "$upstream_status" "$upstream_response_time" "$request_time"';include /usr/local/nginx/conf/vhost/*.conf;
2、vhost中配置文件
#vim /usr/local/nginx/conf/vhost/web.confserver { listen 80 default; server_name www.it300.com; index index.html index.htm index.php; root /data/httpd/it300.com; location ~ .*\.php?$ { include fastcgi.conf; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 1h; } access_log /data/logs/it300.com.log access; }
阅读全文
0 0
- Nginx日志格式设置
- Nginx日志格式设置
- Nginx 用log_format设置日志格式
- Nginx 用log_format设置日志格式
- Nginx服务器log_format设置更详细的日志格式
- Nginx 日志格式简介
- nginx日志格式说明
- nginx日志格式说明
- nginx 日志格式
- nginx 日志格式
- nginx日志格式
- nginx access日志格式
- nginx日志格式配置
- nginx 日志格式打印
- nginx日志格式
- lighttpd 日志格式设置
- lighttpd 日志格式设置
- nginx日志格式的设计
- PAT甲级 1026
- POJ 2104
- ubuntu系统下安装matlab等iso的方法
- 链表
- 深入理解HashMap(及hash函数的真正巧妙之处)
- Nginx日志格式设置
- 形形色色的下拉菜单(课后总结)
- 原始编译全志R16的androidM的步骤(分色排版)V1.1
- uva437 巴比伦塔
- Lambda表达式详解
- session与cookie的区别
- Python3之 单引号,双引号,三个单引号,三个双引号区别之浅谈
- PHP遍历接口Iterator详解
- 3ds Max插件开发(三)The Scene Graph and Nodes 场景节点