nginx、tomcat负载均衡快速部署
1.准备nginx和tomcat的安装包,自己去官网下载
apache-tomcat-7.0.55.tar.gz
nginx-1.10.3.tar.gz
2.编译安装安装nginx
先安装编译环境
yum install pcre pcre-devel openssl openssl-devel zlib zlib-devel
解压
mkdir -p /data/tools
cd /data/tools/
tar -xvf nginx-1.10.3.tar.gz
cd nginx-1.10.3
编译
./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
make && make install
ln -s /usr/local/nginx /etc/nginx
ln -s /usr/local/nginx/sbin/nginx /usr/local/sbin/
# /etc/nginx/sbin/nginx -v
nginx version: nginx/1.10.3
# /etc/nginx/sbin/nginx -V
nginx version: nginx/1.10.3
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC)
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
启动nginx
nginx
语法检查
nginx -t
重载
nginx -s reload
这里我编写了nginx的启动脚本,加入开机自启