认识到Nginx和tomcat服务器配合使用,通过Nginx进行分发实现负载均衡,正好可以学习Nginx的配置和使用,http://www.Nginx.cn/doc/ Nginx中文文档学习配置
1.安装PCRE库
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz tar -zxvf pcre-8.37.tar.gz cd pcre-8.34 ./configure make make install@H_502_17@
2.安装zlib库
wget http://zlib.net/zlib-1.2.10.tar.gz tar -zxvf zlib-1.2.10.tar.gz cd zlib-1.2.10 ./configure make make install@H_502_17@
4.安装ssl
cd /usr/local/src wget https://www.openssl.org/source/openssl-1.0.1t.tar.gz tar -zxvf openssl-1.0.1t.tar.gz@H_502_17@
5.安装Nginx
cd /usr/local/src wget http://Nginx.org/download/Nginx-1.8.9.tar.gz tar -zxvf Nginx-1.9.9.tar.gz cd Nginx-1.9.9 ./configure //执行到这一步的时候 我发现显示OpenSSL library is not used 所以给制定我们部署好的ssl库路径,pcre和zlib库使用系统的默认的,我就没有重新指定了 ./configure --prefix=/usr/local/Nginx --with-openssl=/Nginx/openssl-1.0.1j --with-http_ssl_module make make install@H_502_17@
安装成功后 /usr/local/Nginx 目录下如下
然后执行 /usr/local/Nginx/sbin/Nginx -V //用于查看是否Nginx是否部署成功,报错如下
网上搜下 解决方法(直接运行):
32位系统 ln -s /usr/local/lib/libpcre.so.1 /lib
64位系统 ln -s /usr/local/lib/libpcre.so.1 /lib64
然后在执行 /usr/local/Nginx/sbin/Nginx -V 显示如下信息:
Nginx version: Nginx/1.9.9
启动
sbin/Nginx -c conf/Nginx.conf
6.在浏览器输服务器IP就可以看到: