容器技术交流

 找回密码
 立即注册
查看: 2592|回复: 1

服务器日志能否自定义设置字段的?

[复制链接]
发表于 2012-10-20 09:23:20 | 显示全部楼层 |阅读模式
我们做SEO的人,需要查看每天的服务器日志文件.


======================================================
nginx日志格式说明
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';
   include /usr/local/nginx/conf/vhost/*.conf;
2vhost中配置
   #vim /usr/local/nginx/conf/vhost/www.abc.com.conf
   server
{
        listen       80 default;
        server_name  www.bac.com;
        index index.html index.htm index.php;
        root  /data/httpd/csm.shopex.cn;      
        
        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 /usr/local/nginx/logs/csm.log access;
}
3、说明
$remote_addr   $http_x_forwarded_for 用以记录客户端的ip地址;
$remote_user   :用来记录客户端用户名称;
$time_local   用来记录访问时间与时区;  
$request    用来记录请求的urlhttp协议;
$status       用来记录请求状态;成功是200
$body_bytes_s ent  :记录发送给客户端文件主体内容大小;
$http_referer  :用来记录从那个页面链接访问过来的;
$http_user_agent  :记录客户毒啊浏览器的相关信息;

 楼主| 发表于 2012-10-20 09:26:13 | 显示全部楼层
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Archiver|URLOS ( 粤ICP备18087780号 )

GMT+8, 2025-5-14 18:30 , Processed in 0.032456 second(s), 18 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表