nginx 轉發 客戶端 ip 爲 127.0.0.1

修改nginx配置文件如下(在location中添加:proxy_set_header x-forwarded-for  $remote_addr;

 

 server {
        listen       80;
        server_name  www.zhangshan.top;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            proxy_set_header x-forwarded-for  $remote_addr;
            proxy_pass http://localhost:8084;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章