1.Oracle官网下载JDK
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.tar.gz
2.解压配置JDK环境
tar -zvxf jdk-8u151-linux-x64.tar.gz
cp -R jdk1.8.0_151 /usr/local/jdk1.8
vim /etc/profile
export JAVA_HOME=/usr/local/jdk1.8
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
3.下载Tomcat并配置
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://mirrors.hust.edu.cn/apache/tomcat/tomcat-8/v8.5.24/bin/apache-tomcat-8.5.24.tar.gz
cp -R apache-tomcat-8.5.24 /usr/local/tomcat8.5
4.下载安装配置nginx
yum install nginx
/etc/nginx/conf.d 可以在这里做负债均衡配置
启动Nginx:start nginx
停止Nginx:nginx -s stop
修改配置后重启:nginx -s reload
// weight ip_hash fair url_hash
upstream serverList {
server localhost:8081 weight=1;
server localhost:8082 weight=1;
}
server{
listen 80;
server_name localhost;
location / {
proxy_pass http://serverList;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}