Nginx配置ssl证书
前言
最近做分享时安卓成功,苹果分享失败,说需要配置ssl证书
操作步骤如下:
如果我们服务器上已经安装了,Nginx不需要卸载,步骤如下:
进入安装目录,我理解的是咱们下载以后的目录不是编译的目录,只能一个试一试,或者不行来编译的目录,试一试 ,无论哪个目录,首先找到有此命令的目录:configure就可以了。
/usr/local/nginx/nginx-1.16.0# ./configure --with-http_ssl_module
出现如下错误,继续:
./configure: error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSL library
into the system, or build the OpenSSL library statically from the source
with nginx by using --with-openssl=<path> option.
yum -y install openssl openssl-devel
There are no enabled repos.
Run "yum repolist all" to see the repos you have.
You can enable repos with yum-config-manager --enable <repo>
原因ubuntu14.0 不支持yum下载按装机制
sudo apt-get install openssl
sudo apt-get install libssl-dev
执行成功以后,可以继续执行如下命令:
./configure --with-http_ssl_module //重新添加这个ssl模块
注意!注意! 注意!
我们只能执行如下命令,千万看好,
make
但是不要执行make install,因为make是用来编译的,而make install是安装,不然你整个nginx会重新覆盖的。
在nginx解压目录下,objs文件夹中多了一个nginx的文件,这个就是新版本的程序了。
进入objs目录:
我的Nginx安装的目录有点奇怪,当时不知道怎么弄的:
cp /usr/local/nginx-server/sbin/nginx /usr/local/nginx-server/sbin/nginx.bak
要在objs同级目录下面执行如下命令:
/usr/local/nginx/nginx-1.16.0/objs
cp objs/nginx /usr/local/nginx-server/sbin/nginx
cp: cannot create regular file '/usr/local/nginx-server/sbin/nginx': Text file busy
应该是说nginx在使用,所以不能覆盖,使用一下命令关掉nginx
./nginx -s stop
启动
./nginx
查看是否安装了,ssL模块
如果出现 configure arguments: —with-http_ssl_module 则已安装
TOOD
还没有评论,来说两句吧...