Chinaunix首页 | 论坛 | 博客
  • 博客访问: 10171011
  • 博文数量: 1669
  • 博客积分: 16831
  • 博客等级: 上将
  • 技术积分: 12594
  • 用 户 组: 普通用户
  • 注册时间: 2011-02-25 07:23
个人简介

柔中带刚,刚中带柔,淫荡中富含柔和,刚猛中荡漾风骚,无坚不摧,无孔不入!

文章分类

全部博文(1669)

文章存档

2023年(4)

2022年(1)

2021年(10)

2020年(24)

2019年(4)

2018年(19)

2017年(66)

2016年(60)

2015年(49)

2014年(201)

2013年(221)

2012年(638)

2011年(372)

分类: 网络与安全

2013-11-27 16:23:57

D7-Nginx-SSL
2012-09-10 11:36:30
标签:linux ssl nginx
原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://dngood.blog.51cto.com/446195/986288

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 测试





参考



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



 

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

本文出自 “dongnan” 博客,请务必保留此出处http://dngood.blog.51cto.com/446195/986288

阅读(1271) | 评论(0) | 转发(0) |
0

上一篇:C5-Squid-ACL

下一篇:D11-Nginx-Upgrade

给主人留下些什么吧!~~