标签:access 配置文件 request status 服务端
一、客户端自定义头
如果客户端自定义了一个头。curl -H "wanwan: nihao1111" 192.168.1.192:8888,那么nginx服务端是怎么显示的呢?nginx.conf配置文件log_format添加$http_wanwan(此时的wanwan就是客户端添加的头信息)
二、举例说明
1.主配置
#vim /usr/local/nginx/conf/nginx.conf log_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" "$http_wanwan" ‘; include /usr/local/nginx/conf/vhost/*.conf;
2、vhost中配置文件
#vim /usr/local/nginx/conf/vhost/web.conf
server
{
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;17 }
location ~ .*\.(js|css)?$
{
expires 1h;
}
access_log /data/logs/it300.com.log access;
}本文出自 “自动运维” 博客,请务必保留此出处http://whf191.blog.51cto.com/5763502/1736813
标签:access 配置文件 request status 服务端
原文地址:http://whf191.blog.51cto.com/5763502/1736813