在http模块加入upstreamfuzai{server服务器ip;#有端口的话ip:端口默认80端口可以不写}在server模块需要负载的location加入location/{proxy_passhttp://dis;proxy_set_headerHost$host;proxy_set_headerX-Real-IP$remote_addr;proxy_set_headerX-Forwarded-For$proxy_add_x_forw..
分类:
其他好文 时间:
2016-08-30 22:56:01
阅读次数:
165
客户端的ip变量: $_SERVER['REMOTE_ADDR'] :客户端IP,也有可能是代理IP $_SERVER['HTTP_CLIENT_IP']:代理端的IP,可能存在,也可能伪造 $_SERVER['HTTP_X_FORWARD_FOR'] :用户在哪个ip上使用的id,可能存在,也可能 ...
分类:
Web程序 时间:
2016-08-29 17:52:21
阅读次数:
235
代码如下: $_SERVER['HTTP_ACCEPT_LANGUAGE']//浏览器语言 $_SERVER['REMOTE_ADDR'] //当前用户 IP 。 $_SERVER['REMOTE_HOST'] //当前用户主机名 $_SERVER['REQUEST_URI'] //URL $_SE ...
分类:
Web程序 时间:
2016-08-24 12:36:44
阅读次数:
121
这个来自一些项目中,获取用户Ip,进行用户操作行为的记录,是常见并且经常使用的。 一般朋友,都会看到如下通用获取IP地址方法。 IP获取来源 IP获取来源 1.’REMOTE_ADDR’ 是远端IP,默认来自tcp 连接是,客户端的Ip。可以说,它最准确,确定是,只会得到直接连服务器客户端IP。如果 ...
分类:
其他好文 时间:
2016-08-20 00:11:48
阅读次数:
163
认证反向代理server{listen443ssl;sslon;ssl_certificate/usr/local/nginx/ssl/cn.crt;ssl_certificate_key/usr/local/nginx/ssl/cn.key;server_namewww.aa.com;location/{#proxy_redirectoff;#proxy_set_headerHost$host;#proxy_set_headerX-Real-IP$remote_addr;#proxy_set_h..
分类:
其他好文 时间:
2016-08-06 07:04:45
阅读次数:
292
1. [代码]获取客户端IP地址经纬度所在城市 ? 1 2 3 4 5 6 7 8 9 10 11 12 13 <?php $getIp=$_SERVER["REMOTE_ADDR"]; echo 'IP:',$getIp; echo '<br/>'; $content = file_get_con ...
分类:
Web程序 时间:
2016-08-01 19:15:40
阅读次数:
562
server{listen80;server_nameaaa.com;location/{proxy_passhttp://2.2.2.2/;proxy_set_headerHost$host;proxy_set_headerX-Real-IP$remote_addr;proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for;}#access_log/home/logs/aaa_access.logcombined;}如果后端的机器有..
分类:
其他好文 时间:
2016-07-30 22:44:18
阅读次数:
521
通过nginx做代理,将请求发送给后端的tomcat服务器,并将请求的信息一并传递给后端服务器:proxy_http_version1.1;proxy_set_headerConnection"";proxy_set_headerHost$host;proxy_set_headerx-real-ip$remote_addr;proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for..
分类:
Web程序 时间:
2016-07-29 19:33:20
阅读次数:
462
nginx的自带变量$remote_addr代表客户端的IPremote_addr代表客户端的IP,但它的值不是由客户端提供的,而是服务端根据客户端的ip指定的,当你的浏览器访问某个网站时,假设中间没有任何代理,那么网站的web服务器(Nginx,Apache等)就会把remote_addr设为你的机器IP,如果你用..
分类:
其他好文 时间:
2016-07-18 05:43:40
阅读次数:
1490
日志格式 log_format main '$remote_addr - $remote_user [$time_local] $request ' '"$status" $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_ ...
分类:
其他好文 时间:
2016-07-15 06:32:55
阅读次数:
121