如何在编译安装成功的nginx 添加http_ssl_module模块
1.首先看下内核和系统的版本号。
[root@zabbix ~]# uname -a
Linux zabbix.nnkj.com 2.6.32-573.el6.x86_64 #1 SMP Thu Jul 23 15:44:03 UTC 2015 x86_64 x86_64
x86_64 GNU/Linux
[root@zabbix ~]# cat /etc/issue
CentOS release 6.5 (Final)
Kernel \r on an \m
2.看下编译安装nginx的时候,都编译安装的哪些模块。
[root@zabbix ~]# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.10.2
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC)
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: –prefix=/usr/local/nginx
3.进入之前下载并解压了的源码包目录;重新编译nginx
[root@zabbix nginx-1.10.2]# cd /usr/local/src/nginx-1.10.0
[root@zabbix nginx-1.10.2]# ./configure –prefix=/usr/local/nginx –with-http_stub_status_module –with-http_ssl_module
.[root@zabbix nginx-1.10.2]# make
▲这一步千万不能 make install ;不然会把之前已经安装的nginx 覆盖掉
4.之后会看在当前目录生成objs文件,执行
./objs/nginx -V
nginx version: nginx/1.10.2
built by gcc 4.1.2 20080704 (Red Hat 4.1.2-55)
built with OpenSSL 1.0.0d 8 Feb 2011
TLS SNI support enabled
发现 TLS SNI support enabled 这我们可以放心用了,这可以实现一个ip多个站点。
但是nginx -v 这时候还是老版本的nginx,下面我们需要做的比较关键
我们需要先备份
mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.old
然后转移
cp ./objs/nginx /usr/local/nginx/sbin/nginx
测试下
/usr/local/nginx/sbin/nginx -t
ok,执行更新
make upgrade
然后的最后
nginx -V
nginx version: nginx/1.10.2
built by gcc 4.1.2 20080704 (Red Hat 4.1.2-55)
built with OpenSSL 1.0.0d 8 Feb 2011…
到此就成功了升级了 nginx 并且添加了 TLS SNI support 。
5.再次查看nginx的模块,看下是否把需要的模块编译进去了
[root@zabbix ~]# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.10.2
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC)
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: –prefix=/usr/local/nginx –with-http_stub_status_module –with-http_ssl_module
6.重新启动nginx;
[root@zabbix nginx-1.8.0]# netstat -lnp|grep nginx //查看是否正常监听80端口