开发者社区> 问答> 正文

nginx日志中如何获取用户的真实IP





CentOS  6.3 64位  AMH 4.2面板


按照官方http://help.aliyun.com/knowledge_detail.htm?knowledgeId=5973903#nginx  这个教程来做,效果出不了,


重启nginx后日志里的IP还是waf云盾的IP,无法获取用户的真实IP。


谁知道的告诉下咯

展开
收起
代码女神 2015-08-07 20:34:47 7008 0
2 条回答
写回答
取消 提交回答
  • 解决方案工程师,负责为企业规划上云迁移方案和云上架构设计,在网站建设开发和云计算领域有多年经验,专注于Linux平台的系统维护以及应用部署。致力于以场景化的方式让云计算,用更加通俗易懂的方式让更多人体验云计算,让云端的计算更质朴的落地。
    回 2楼(代码女神) 的帖子
    http://bbs.aliyun.com/read/253513.html
    2015-08-09 10:22:18
    赞同 展开评论 打赏
  • Renginx日志中如何获取用户的真实IP

    nginx.conf内容如下:




    user  www www;
    worker_processes auto;
    error_log  /home/wwwroot/index/log/nginx_error.log  crit;
    pid  /usr/local/nginx/logs/nginx.pid;


    #Specifies the value for maximum file descriptors that can be opened by this process.
    worker_rlimit_nofile 51200;


    events
    {
        use epoll;
        worker_connections 51200;
    }


    http
    {
        include  mime.types;
        default_type  application/octet-stream;
        server_names_hash_bucket_size 128;
        client_header_buffer_size 16k;
        large_client_header_buffers 4 4k;
        client_max_body_size 1024m;


        sendfile on;
        tcp_nopush on;


        keepalive_timeout 60 60;


        fastcgi_connect_timeout 600;
        fastcgi_send_timeout 600;
        fastcgi_read_timeout 600;
        fastcgi_buffer_size 256k;
        fastcgi_buffers 16 256k;
        fastcgi_busy_buffers_size 512k;
        fastcgi_temp_file_write_size 512k;
        fastcgi_intercept_errors on;


        tcp_nodelay on;
        server_tokens off;
        gzip             on;
        gzip_min_length  1000;
        gzip_proxied     expired no-cache no-store private auth;
        gzip_types       text/plain text/css text/xml text/javascript application/x-javascript application/xml application/rss+xml application/xhtml+xml application/atom_xml;
        gzip_disable "MSIE [1-6].(?!.*SV1)";
        log_format  access  '$remote_addr - $remote_user [$time_local] "$request" '
        '$status $body_bytes_sent "$http_referer" '
        '"$http_user_agent" $http_x_forwarded_for';


        include vhost/*.conf;
        server
        {
            listen  8888;
            server_name 105.29.244.78;
            index index.html index.htm index.php;
            root  /home/wwwroot/index/web;
             if ( $host != '105.29.244.78' ) { return 400; }
            fastcgi_buffer_size 4k;
                    fastcgi_buffers 8 4k;
                    fastcgi_busy_buffers_size 4k;
                    gzip off;


            location ~ .*\.php$
            {
                fastcgi_pass unix:/tmp/php-cgi.sock;
                fastcgi_index index.php;
                include fcgi.conf;
            }


            location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
            {
                expires      30d;
            }


            location ~ .*\.(js|css)?$
            {
                expires      12h;
            }
        
            access_log  /home/wwwroot/index/log/access.log combined;
            error_log   /home/wwwroot/index/log/error.log crit;
        }


        server
        {
            listen 80 default;
            return 400;
        }
    }

    -------------------------

    Renginx日志中如何获取用户的真实IP
    不要沉了,知道的人回复下咯,谢谢!
    2015-08-07 20:40:10
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
2019大数据技术公开课第五季—日志数据如何同步到MaxCompute之实践讲解 立即下载
CentOS Nginx PHP JAVA 多语言镜像使用手 立即下载
CentOS Nginx PHP JAVA多语言镜像使用手册 立即下载