Http://blog.bbzhh.com/index.php/archives/135.html
In the VPS to build the Nginx and Tomcat application, want to through Nginx to reverse proxy 127.0.0.1:8080 Tomcat external service, but 8080 port always provide listening to all the external address, the modification method has the following three kinds:
Scenario One: Use a firewall to intercept port 8080
This is the first can think of the practice, directly in the iptables to do it, do not make too many statements;
Scenario Two: Modify the Tomcat global listener only 127.0.0.1
In $catalina_home/conf/server.xml, find a tab segment similar to the following description 8080 listener:
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
Add: address= "127.0.0.1" in this tab
When you are done:
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" address="127.0.0.1" redirectPort="8443" />
All of the applications released under Tomcat can only be accessed by 127.0.0.1.
Scenario Three: Modify an app under Tomcat to listen only 127.0.0.1
Find the label for the application path configuration in $catalina_home/conf/server.xml, for example:
<context path="/blog" reloadable="true" docBase="/var/www/blog" />
After adding the listener bindings in the Context tab, modify to:
<context path="/blog" reloadable="true" docBase="/var/www/blog"> <value className="org.apache.catalina.values.RemoteAddrValue" allow="127.0.0.1" deny="" /></context>
It can also be set to be accessed by specific address segments, such as allowing access only to IP segments such as 192.168.1.0-192.168.5.255 and 192.168.10.0-192.168.15.255:
<context path="/blog" reloadable="true" docBase="/var/www/blog"> <value className="org.apache.catalina.values.RemoteAddrValue" allow="192.168.[1-5].*,192.168.[10-15].*" deny="" /></context>
The above scenarios for Tomcat configuration file modifications are in effect after you restart Tomcat
Restrict Tomcat to respond to natively requests only (GO)