nginx + tomcat structure to obtain the real IP approach

2010-03-29  来源:本站原创  分类:Java  人气:288 

The first step: In the nginx.conf configure reverse proxy at the time of the real IP onto, for example:

server (
listen 80;
server_name boyan.com;
location ~ ^ / (WEB-INF) / (
deny all;
)

location / (
proxy_pass http://localhost:8888;
proxy_set_header X-Real-IP $ remote_addr;
)
)

Step two: an application using String ip = request.getHeader ( "X-Real-IP"); Alternative String ip = request.getRemoteAddr (); can be

相关文章
  • nginx + tomcat structure to obtain the real IP approach 2010-03-29

    The first step: In the nginx.conf configure reverse proxy at the time of the real IP onto, for example: server ( listen 80; server_name boyan.com; location ~ ^ / (WEB-INF) / ( deny all; ) location / ( proxy_pass http://localhost:8888; proxy_set_heade

  • CentOS under Nginx + tomcat + MySQL server installation 2010-04-14

    linux is also very long exposure, and have never had to really use. Want to own some of the recent development of small application deployment to the linux server, by the way also to learn about linux server. Then with a host (general pc, pc stabilit

  • [Change] nginx + tomcat cluster load balancing (to achieve session replication) 2010-09-19

    Keywords: Nginx, Tomcat, clustering, load balancing Transfer from: http://blog.chinaunix.net/u2/83793/showart_1354266.html Architecture Description Nginx front-end server to do a load balancer, back up the cluster composed of N sets tomcat processing

  • nginx + tomcat cluster load balancing (to achieve session replication) 2010-12-11

    Nginx + tomcat load balancing done Architecture Description Nginx front-end server to do a load balancer, put back the cluster composed of N units tomcat processing services, nginx forwarded through to the back (Note: did not do static and dynamic se

  • Nginx + tomcat under linux installation and configuration of integrated 2010-04-08

    Objective: To build Nginx integration with tomcat, apache with Nginx instead of Steps: First, install Tomcat and JDK 1, From apache-tomcat-6.0.18.tar.gz and jdk-6u12-linux-i586.bin to / usr / local 2, execute the following command to install tomcat:

  • RedHat Linux AS 5 installation and under Nginx Nginx + Tomcat load balancing configuration 2010-11-11

    First, the software is ready zlib-1.2.5.tar.gz [support gzip], Download Address: http://www.zlib.net/ pcre-8.10.tar.gz [support rewrite module], download address: http://sourceforge.net/projects/pcre/files/ openssl-1.0.0a.tar.tar [support ssl], downl

  • Nginx + Tomcat load balancing in Windows, do 2010-11-30

    First, why do load balancing on the Tomcat server: Tomcat server as a Web server, in 300-500 between the number of concurrent, if there is more than 500 the number of concurrent appears Tomcat can not respond to new requests, seriously affect the ope

  • Nginx + Tomcat installation and configuration of integrated (switch) 2011-02-18

    1. Preparation software apache-tomcat-6.0.26.tar.gz http://tomcat.apache.org/download-60.cgi jdk-6u20-linux-i586.bin http://java.sun.com/javase/downloads/index.jsp nginx-0.8.15.tar.gz http://nginx.org/en/download.html pcre-7.9.tar.gz http://sourcefor

  • Nginx+tomcat配置集群负载均衡 2013-05-15

    作者:niumd Blog:http://ari.iteye.com 转载请注明出处,谢谢 开发的应用采用F5负载均衡交换机,F5将请求转发给5台hp unix服务器,每台服务器有多个webserver实例,对外提供web服务和socket等接口服务.之初,曾有个小小的疑问为何不采用开源的 apache.Nginx软件负载,F5设备动辄几十万,价格昂贵?自己一个比较幼稚的问题,后续明白:F5是操作于IOS网络模型的传输 层,Nginx.apache是基于http反向代理方式,位于ISO模型的第七

  • Nginx+Tomcat动静分离及Nginx优化 2014-04-26

    目的:nginx处理用户请求的静态页面,tomcat处理用户请求jsp页面,来实现动态分离,nginx处理静态页面效率远高于tomcat,这样一来就能更好的提高并发,处理性能. 准备软件: 下载jdk1.7:http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html 下载tomcat8.0:http://tomcat.apache.org/download-80.cgi 下载nginx1.

  • Nginx学习之十:Nginx+Tomcat多站点访问默认主页问题 2014-07-10

    Nginx+Tomcat配置后,访问多个站点时,默认主页老转向Tomcat的主页. 经过仔细检查,发现问题所在,我想这也是大家常常需要注意的地方,否则经常出现以上类似问题会让人懊恼的. 1.Tomcat的server.xml文件配置多个站点: 01 <Engine name="Catalina" defaultHost="www.abc.com"> 02 <Host name="www.abc.com" appBase=&quo

  • Nginx+tomcat配置集群 2014-09-23

    开发的应用采用F5负载均衡交换机,F5将请求转发给5台hp unix服务器,每台服务器有多个webserver实例,对外提供web服务和socket等接口服务.之初,曾有个小小的疑问为何不采用开源的apache.Nginx软件负载,F5设备动辄几十万,价格昂贵?自己一个比较幼稚的问题,后续明白:F5是操作于IOS网络模型的传输层,Nginx.apache是基于http反向代理方式,位于ISO模型的第七层应用层.直白些就是TCP UDP 和http协议的区别,Nginx不能为基于TCP协议的应用提

  • nginx + tomcat + java SSL客服端 2015-01-16

    =====nginx + tomcat + java SSL客服端======= 1. 通过keytool 生成密钥库 [注意 CN 为服务端访问域名地址或者IP地址或者主机名 比如 config.ebnew.com](密钥库密码为:bidconfig) keytool -genkey -alias configserver -keystore configstore.jks -keypass bidconfig -storepass bidconfig -keyalg RSA -validit

  • Nginx + Tomcat + Ngx_cache_purge 实现高效反向代理 2015-04-02

    Nginx处理用户请求的静态页面,tomcat处理用户请求jsp页面,来实现动态分离,前端nginx反向代理后端nginx+tomcat集群,实现负载均衡,这样一来就能更好的提高并发,处理性能,并隐藏后端,提高安全 环境: 前端: Centos 192.168.0.211: nginx + Ngx_cache_purge 后端1: Centos 192.168.0.222: nginx + Tomcat 后端2: Centos 192.168.0.223:nginx + Tomcat 使用软件:

  • Liunx building under nginx + tomcat cluster 2010-05-22

    nginx apache installation to install than the more simple, I mainly refer to the following installed on this article http://www.jsprun.net/thread-16889-1-1.html I guarantee when installed apache + tomcat2 two tomcat cluster fixed, it apcache stopped

  • Liunx nginx + tomcat cluster under construction 2010-05-22

    nginx apache installation to install than the more simple, I mainly refer to the following installed on this article http://www.jsprun.net/thread-16889-1-1.html I guarantee when installed apache + tomcat2 two tomcat cluster fixed, it apcache stopped

  • Set nginx prohibited to access the server via IP 2010-07-21

    Today to prohibit the Nginx Shang Setting IP access server, can only access through domain names, so that done to avoid people to Wei record domain name resolution to your server IP Er cause Fu Wuqi was broken network, from the network search to the

  • haproxy nginx tomcat 2010-09-25

    Be the plane ride the haproxy nginx tomcat architecture model Nginx does not haproxy listening on port 80 when the request will be forwarded to the back end of the dynamic 8080 After a haproxy haproxy transmitted to monitor 80 of the 8001 nginx nginx

  • Nginx作为反向代理时传递客户端IP的设置方法 2014-09-29

    因为nginx的优越性,现在越来越多的用户在生产环境中使用nginx作为前端,不管nginx在前端是做负载均衡还是只做简单的反向代理,都需要把日志转发到后端real server,以方便我们检查程序的各种故障 nginx默认配置文件里面是没有进行日志转发配置的,这个需要我们自己手动来操作了,当然后端的real server不同时操作方法是不一样的,这里我们分别例举几种情况来说明一下. nginx做前端,转发日志到后端nginx服务器: 因为架构的需要采用多级 Nginx 反向代理,但是后端的程序

  • python实现分析apache和nginx日志文件并输出访客ip列表的方法 2015-03-09

    这篇文章主要介绍了python实现分析apache和nginx日志文件并输出访客ip列表的方法,涉及Python操作日志文件的技巧,非常具有实用价值,需要的朋友可以参考下 本文实例讲述了python实现分析apache和nginx日志文件并输出访客ip列表的方法.分享给大家供大家参考.具体如下: 这里使用python分析apache和nginx日志文件输出访客ip列表 ips = {} fh = open("/var/log/nginx/access.log", "r&quo