systemctl stop firewalld
setenforce 0
yum -y install pcre-devel zlib-devel openssl-devel gcc gcc-c++ make
useradd -M -s /sbin/nologin nginx、
cd /opt
tar zxvf nginx-1.12.0.tar.gz -C /opt/
./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-file-aio --with-http_stub_status_module --with-http_gzip_static_module --with-http_flv_module --with-stream
make && make install
ln -s /usr/local/nginx/sbin/nginx /usr/local/sbin/
vim /lib/systemd/system/nginx.service
chmod 754 /lib/systemd/system/nginx.service
systemctl start nginx.service
systemctl stop firewalld
setenforce 0
tar zxvf jdk-8u91-linux-x64.tar.gz -C /usr/local/
vim /etc/profile
export JAVA_HOME=/usr/local/jdk1.8.0_91
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
source /etc/profile
tar zxvf apache-tomcat-8.5.16.tar.gz
mv /opt/apache-tomcat-8.5.16/ /usr/local/tomcat
/usr/local/tomcat/bin/shutdown.sh
/usr/local/tomcat/bin/startup.sh
netstat -ntap | grep 8080
mkdir /usr/local/tomcat/webapps/test
vim /usr/local/tomcat/webapps/test/index.jsp
vim /usr/local/tomcat/conf/server.xml
/usr/local/tomcat/bin/shutdown.sh
/usr/local/tomcat/bin/startup.sh
mkdir /usr/local/tomcat/webapps/test
vim /usr/local/tomcat/webapps/test/index.jsp
vim /usr/local/tomcat/conf/server.xml
#准备静态页面和静态图片
echo '
mkdir /usr/local/nginx/html/img
cp /root/game.jpg /usr/local/nginx/html/img
vim /usr/local/nginx/conf/nginx.conf
目录
一、部署Nginx负载均衡器
1.关闭防火墙和安全机制
2.安装依赖环境
3.安装nginx程序用户
4.编译安装nginx
5.赋予权限
6.重启服务
二、配置Tomcat应用服务器
三、动静分离配置
tomcat2配置同理
四、Nginx server 配置
五、访问测试
访问测试http://192.168.146.111
访问测试http://192.168.146.111/555.png
测试负载均衡效果,不断刷新浏览器测试浏览器访问 http://192.168.146.111index.jsp
第一次
第二次