nginx tomcat 负载均衡
安装 yum install lrzsz
安装JDK
1,yum install java-1.7.0-openjdk
2,配置java_home
a: export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.95
b: vi /etc/profile 将下面的三行粘贴到 /etc/profile 中:
export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.95
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
source /etc/profile 生效
安装tomcat
1,yum install tomcat6
2,安装目录
配置文件:/etc/tomcat6
主目录 :/var/lib/tomcat6
统一管理目录:/usr/share/tomcat6
3,启动 service tomcat6 restart
安装nginx
1,yum install nginx
安装后,NGINX的网站目录位于: /usr/share/nginx/html NGINX的配置文件位于: /etc/nginx/ nginx.conf
nginx 负载均衡配置 nginx.conf
upstream 192.168.175.128 {
server 192.168.175.129:8080 weight=1;
server 192.168.175.130:8080 weight=1;
ip_hash;
}
server {
listen 80;
location / {
proxy_pass http://192.168.175.128;
}
}