nginx配置https之使用第三方证书
2016-11-09 14:51
856 查看
1、检查nginx的ssl模块--with-http_ssl_module是否安装,如果没有需要重新编译安装。
2、修改nginx配置文件。
在nginx的conf目录下新建key目录来存放证书。
3、上传证书到/usr/local/websrv/nginx/conf/key目录下
4、重新reload nginx让配置生效。
5、客户端浏览器测试。
[root@huanan1-cloud-test01 ~]# /usr/local/websrv/nginx/sbin/nginx -V nginx version: nginx/1.6.3 built by gcc 4.8.5 20150623 (Red Hat 4.8.5-4) (GCC) TLS SNI support enabled configure arguments: --user=nobody --group=nobody --with-http_ssl_module --with-http_stub_status_module --prefix=/usr/local/websrv/nginx-1.6.3/ [root@huanan1-cloud-test01 ~]#ok!已经安装完成了,不用重新编译安装了。
2、修改nginx配置文件。
在nginx的conf目录下新建key目录来存放证书。
[root@huanan1-cloud-test01 ~]# cd /usr/local/websrv/nginx-1.6.3/conf/ [root@huanan1-cloud-test01 /usr/local/websrv/nginx-1.6.3/conf]# mkdir keynginx.conf开启ssl,在要配置https的站点目录的server标签里添加52-55行
[root@huanan1-cloud-test01 /usr/local/websrv/nginx-1.6.3/conf]# vim nginx.conf .... 48 listen 80; 49 server_name test.hrfax.cn hrfax.cn; 50 51 # 添加如下 52 listen 443; 53 ssl on; 54 ssl_certificate key/server.crt; 55 ssl_certificate_key key/server.key; ....
3、上传证书到/usr/local/websrv/nginx/conf/key目录下
[root@huanan1-cloud-test01 /usr/local/websrv/nginx-1.6.3/conf]# ls key/ server.crt server.key
4、重新reload nginx让配置生效。
[root@huanan1-cloud-test01 /usr/local/websrv/nginx-1.6.3/conf]# ../sbin/nginx -t nginx: the configuration file /usr/local/websrv/nginx-1.6.3//conf/nginx.conf syntax is ok nginx: configuration file /usr/local/websrv/nginx-1.6.3//conf/nginx.conf test is successful [root@huanan1-cloud-test01 /usr/local/websrv/nginx-1.6.3/conf]# ../sbin/nginx -s reload [root@huanan1-cloud-test01 /usr/local/websrv/nginx-1.6.3/conf]# netstat -ntlpua|grep 443 tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 1908/nginx: master
5、客户端浏览器测试。
相关文章推荐
- Nginx https的安装配置以及证书的使用
- 使用阿里云https证书nginx安装配置详解
- 在linux(centos)使用openssl生成https证书并配置到nginx的实现过程
- nginx使用ssl模块配置HTTPS支持(自签证书)
- 使用自签的证书配置nginx的https
- nginx中使用https时,证书的生成方式及配置
- nginx 自签名证书 配置 https
- web服务器使用HTTPS,基于tomcat :nginx配置
- windows2008 使用nginx 反向代理实现负载均衡解决HTTPS 证书问题
- 为nginx配置https并自签名证书
- 为nginx配置https并自签名证书
- nginx使用ssl模块配置HTTPS支持
- nginx使用ssl模块配置HTTPS支持
- nginx使用ssl模块配置HTTPS支持
- 使用Nginx为Leanote配置Https
- nginx配置:登录使用https
- 转自《https安全链接的配置教程:startSSl免费证书申请与nginx的https支持配置》
- nginx配置SSL证书(使用startSSL申请到的免费证书)
- Windows下Tomcat+nginx配置证书实现登录页https访问
- 数字证书、SSL、HTTPS及在Nginx中的配置