1. 首先搭建nginx服务器
安装依赖:
yum install gcc-c++
yum install -y pcre pcre-devel
yum install -y zlib zlib-devel
yum install -y openssl openssl-devel
下载nginx源码包:
wget http://nginx.org/download/nginx-1.12.0.tar.gz
1).解压缩:tar -zxvf nginx-1.12.0.tar.gz
2).进入解压缩后文件夹:cd nginx-1.12.0
安装之前需要手动创建指定的nginx文件夹,即/var/temp、/var/temp/nginx、/var/run/nginx/文件夹,否则启动时报错.
配置http和https:
./configure --prefix=/usr/local/nginx --with-http_stub_status_module--with-http_ssl_module
编译并安装
make
make install
可以进入/usr/local/nginx查看文件是否存在conf、sbin、html文件夹,若存在则安装成功
启动nginx
在nginx目录下有一个sbin目录,sbin目录下有一个nginx可执行程序
./nginx
重新加载配置文件
./nginx -s reload 可以不关闭nginx的情况下更新配置文件
配置nginx.conf
cd /usr/local/nginx/conf/
vi nginx.conf
2. 安装tomcat集群
把nginx作为tomcat的代理服务器