D7-Nginx-SSL

简介:
+关注继续查看

D7-Nginx-SSL
 

1 准备SSL证书


  1. mkdir /usr/local/nginx/conf/ssl 
  2. cd /usr/local/nginx/conf/ssl 

//生成私钥 
//rsa私钥(带密码),des3 算法, 1024 位强度


  1. openssl genrsa -des3 -out server.key 1024 

Generating RSA private key, 1024 bit long modulus
.......++++++
...................++++++
e is 65537 (0x10001)
Enter pass phrase for server.key:                     #password
Verifying - Enter pass phrase for server.key:      #再次输入

//生成证书请求文件 

//提示输入国家、省份、城市、域名信息等,重要的是email 一定要是你的域名后缀的,比如 dongnan@test.com 并且能接受邮件!


  1. openssl req -new -key server.key -out server.csr 

Enter pass phrase for server.key:                     #dongnan
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [GB]:CN      
State or Province Name (full name) [Berkshire]:BJ
Locality Name (eg, city) [Newbury]:BJ
Organization Name (eg, company) [My Company Ltd]:YK
Organizational Unit Name (eg, section) []:YK
Common Name (eg, your name or your server's hostname) []:test.com
Email Address []:dongnan@test.com

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

//生成私钥(不含密码)


  1. cp server.key server.key.org 
  2. openssl rsa -in server.key.org -out server.key 

Enter pass phrase for server.key.org:                  #dongnan
writing RSA key

//生成证书


  1. openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt 

Signature ok
subject=/C=CN/ST=BJ/L=BJ/O=YK/OU=YK/CN=test.com/emailAddress=dongnan@test.com
Getting Private key

2 配置 Nginx


  1. chmod -R 600 /usr/local/nginx/conf/ssl 

  1. vim /usr/local/nginx/conf/vhosts/proxy.conf        
  2.         listen          443 ssl; 
  3.         server_name     client.test.com; 
  4.         ssl_certificate      ssl/server.crt; 
  5.         ssl_certificate_key  ssl/server.key; 

  1. nginx -t && nginx -s reload 


3 测试





参考

HttpSslModule

Nginx + https + 免费SSL证书配置指南


Nginx 下配置SSL证书的方法
 

结束
更多请:
linux 相关 37275208
vmware 虚拟化相关  166682360


本文转自 dongnan 51CTO博客,原文链接:http://blog.51cto.com/dngood/986288

相关文章
|
2月前
|
应用服务中间件 网络安全 nginx
Nginx学习研究-Nginx 安装 SSL 配置 HTTPS
Nginx学习研究-Nginx 安装 SSL 配置 HTTPS
|
4月前
|
安全 应用服务中间件 网络安全
nginx-ssl模块
nginx-ssl模块
44 0
|
4月前
|
安全 应用服务中间件 网络安全
nginx_ssl模块
nginx_ssl模块
|
4月前
|
安全 应用服务中间件 网络安全
nginx和ssl模块
nginx和ssl模块
49 0
|
6月前
|
负载均衡 安全 数据建模
nginx中的ssl模块
nginx中的ssl模块
203 1
|
7月前
|
安全 算法 应用服务中间件
重识Nginx - 12 SSL/TLS 浅析
重识Nginx - 12 SSL/TLS 浅析
56 0
|
应用服务中间件 网络安全 nginx
Nginx ssl双向认证
Nginx ssl双向认证
352 0
Nginx ssl双向认证
|
网络协议 应用服务中间件 Linux
nginx 1.18配置ssl问题
nginx1.18配置ssl问题
861 0
nginx 1.18配置ssl问题
|
域名解析 弹性计算 负载均衡
Nginx系列教程(8)nginx配置安全证书SSL
一,环境说明 服务器系统:centos7 服务器IP地址:云服务器的公网IP 域名:bjubi.com 简单步骤流程: 拥有一台服务器(省略)》申请注册域名(省略)》申请免费ssl安全证书》Centos安装Nginx》Nginx配置ssl》网站https访问成功 二,域名解析到服务器 在阿里云控制台-产品与服务-云解析DNS-找到需要解析的域名点“解析”,进入解析页面后选择【添加解析】按钮会弹出如下页面: 主机记录这里选择@,记录值就是服务器ip地址,确认。
6348 0
|
应用服务中间件 网络安全 数据安全/隐私保护
Nginx之5金钟罩 - (SSL)
Nginx从入门到深入之SSL
2260 0
相关产品
云迁移中心
推荐文章
更多