标签:负载均衡 反向代理 nginx+tomcat
[root@server12 ~]# sh jdk-6u32-linux-x64.bin [root@server12 ~]# mv jdk1.6.0_32/ /usr/local/ [root@server12 ~]# cd /usr/local/ [root@server12 local]# mv jdk1.6.0_32/ java [root@server12 local]# which java /usr/local/java/bin/java
vim /etc/profile
export JAVA_HOME=/usr/local/java export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib export PATH=$PATH:$JAVA_HOME/bin
. /etc/profile
vim test.java
class test { public static void main(String[] args) { System.out.println("hello world!"); } }
编译和执行
[root@server12 ~]# javac test.java [root@server12 ~]# java test hello world!
[root@server12 ~]# tar zxf apache-tomcat-7.0.37.tar.gz -C /usr/local/ [root@server12 ~]# cd /usr/local/ [root@server12 local]# ln -s apache-tomcat-7.0.37/ tomcat [root@server12 local]# cd tomcat/ [root@server12 tomcat]# cd bin/ [root@server12 bin]# ./startup.sh
netstat -antlpue
tcp 0 0 :::8080 :::* LISTEN 0 20026 1718/java
tomcat页面
cd /usr/local/nginx/conf/
vim nginx.conf
22 http { 23 include mime.types; 24 default_type application/octet-stream; 25 26 upstream westos{ 27 server 172.25.88.12:8080; 28 server 172.25.88.13:8080; 29 } 69 location ~ \.jsp$ { 70 proxy_pass http://westos;
nginx -s reload
cd /usr/local/
scp -r tomcat/ java/ 172.25.4.13:/usr/local/
cd /usr/local/tomcat/webapps/ROOT
vim test.jsp
server2 the time is: <%=new java.util.Date() %>
cd /usr/local/tomcat/bin/ ./startup.sh
server13:
cd /usr/local/tomcat/webapps/ROOT
vim test.jsp
server3 the time is: <%=new java.util.Date() %>
vim /etc/profile
export JAVA_HOME=/usr/local/java export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib export PATH=$PATH:$JAVA_HOME/bin
cd /usr/local/tomcat/bin/ ./startup.sh
浏览器访问
http://172.25.88.11/test.jsp
2/3实现负载均衡
本文出自 “12049878” 博客,谢绝转载!
标签:负载均衡 反向代理 nginx+tomcat
原文地址:http://12059878.blog.51cto.com/12049878/1910911