为了实现https,查询实验了很多。首先用的是阿里云的免费ssl证书,配置过程如下。
主要参考张戈博客文章:
1、Nginx在线服务状态下平滑升级或新增模块的详细操作记录
2、
折腾过程如下:
一、解决nginx服务器没有编译ssl模块。
执行命令nginx -V
查看是否存在--with-http_ssl_module参数,如果没有这个参数,说明没有编译SSL模块。
以下是张戈提供nginx的半自动平滑升级的方法:
①、按需编译新版本的nginx
根据需求,常规编译新版本nginx,不过只要执行到make就打住,不要make install!
#下载1.11.8版本,并解压 cd /alidata/server wget http://nginx.org/download/nginx-1.11.8.tar.gz tar zxvf nginx-1.11.8.tar.gz #根据实际需要新增的模块,先准备所需文件(其实只需要解压即可,全部安装,后面编译就可以不指定路径了): #1. 安装pcre: cd /alidata/server wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz tar -zxvf pcre-8.38.tar.gz cd pcre-8.38 ./configure && make && make install #2. 安装zlib: cd /alidata/server wget http://zlib.net/zlib-1.2.9.tar.gz tar -zxvf zlib-1.2.9.tar.gz cd zlib-1.2.9 ./configure && make && make install #3. 安装openssl: cd /alidata/server wget http://www.openssl.org/source/openssl-1.1.0c.tar.gz tar -zxvf openssl-1.1.0c.tar.gz cd openssl-1.1.0c ./config && make && make install #加上所需参数开始编译#对应openssl源码解压后的路径(openssl,pcre,zlib): ./configure --user=www --group=www --prefix=/alidata/server/nginx --with-http_ssl_module --with-http_stub_status_module --with-openssl=/alidata/server/openssl-1.1.0c --with-pcre --with-pcre=/alidata/server/pcre-8.38 --with-zlib=/alidata/server/zlib-1.2.9 make #执行make编译,但是不要执行make install
注:
wget //下载,上面所下载版本2017年1月2日最新
tar -zxvf //解压缩
. /congfig 或 ./congfigure //配置
make //编译
make install //安装
②、重命名nginx旧版本二进制文件,即sbin目录下的nginx(期间nginx并不会停止服务!):
mv /alidata/server/nginx/sbin/nginx /alidata/server/nginx/sbin/nginx.old
③、然后拷贝一份新编译的二进制文件:
cp objs/nginx /alidata/server/nginx/sbin/
④、在源码目录执行make upgrade开始升级
flytofilm网站的nginx有ssl编译,所以暂时不折腾,有空来升级一下nginx
请登录以参与评论
现在登录