linux nginx ssl证书怎么配置
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux nginx ssl证书怎么配置相关的知识,希望对你有一定的参考价值。
nginx安装SSL证书:https://www.gworg.com/ssl/107.htmlNginx 自动跳转到HTTPS:https://www.gworg.com/ssl/167.html
注意:安装防火墙需要设置允许443端口或关闭防火墙,如果本地服务器安装安全狗的,请允许443端口。SSL证书需要淘宝Gworg获取。 参考技术A 常见的服务器配置SSL证书方法指南,linux nginx 配置SSL证书教程:https://www.wosign.com/Docdownload/index.htm
Linux Nginx 配置 SSL 证书支持 HTTPS 访问(参考)
由于之前(Linux nginx安装与配置(参考))已经安装好了 nginx 所以要重新下载包编译 ssl
1.停止运行 nginx
systemcrl stop nginx.service
2.下载 nginx
cd /home/download wget http://nginx.org/download/nginx-1.4.4.tar.gz tar -xvf nginx-1.4.4.tar.gz cd nginx-1.4.4
3.尝试编译 ssl
./configure --prefix=/home/nginx --with-http_stub_status_module --with-http_ssl_module
这里如果出现以下错误说明未安装 openssl,需要先安装(第四步)再重新执行第三步编译
./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.
出现以下内容则编译成功
Configuration summary + using system PCRE library + using system OpenSSL library + md5: using OpenSSL library + sha1: using OpenSSL library + using system zlib library + jemalloc library is disabled nginx path prefix: "/usr/local/nginx" nginx binary file: "/usr/local/nginx/sbin/nginx" nginx configuration prefix: "/usr/local/nginx/conf" nginx configuration file: "/usr/local/nginx/conf/nginx.conf" nginx pid file: "/usr/local/nginx/logs/nginx.pid" nginx error log file: "/usr/local/nginx/logs/error.log" nginx http access log file: "/usr/local/nginx/logs/access.log" nginx http client request body temporary files: "client_body_temp" nginx dso module path: "/usr/local/nginx/modules/" nginx http proxy temporary files: "proxy_temp" nginx http fastcgi temporary files: "fastcgi_temp" nginx http uwsgi temporary files: "uwsgi_temp" nginx http scgi temporary files: "scgi_temp"
4.安装 openssl(出现上述错误执行)
yum -y install openssl openssl-devel
5.编译通过执行 make,不要进行 make install,否则就是覆盖安装
make
6.备份已经安装好的 nginx
cp /home/nginx/sbin/nginx /home/nginx/sbin/nginx.bak
7.将编译好的 nginx 覆盖原有的 nginx
cp /home/download/nginx-1.4.4/objs/nginx /home/nginx/sbin/
8.启动 nginx
systemcrl start nginx.service
9.访问已配置好的 https 页面查看
以上是关于linux nginx ssl证书怎么配置的主要内容,如果未能解决你的问题,请参考以下文章