PHP程序员站--PHP编程开发平台
 当前位置:主页 >> 服务器 >> 其他服务器 >> 

在Nginx上配置NameCheap免费SSL

在Nginx上配置NameCheap免费SSL

来源:互联网  作者:  发布时间:2010-05-21
4月底在NameCheap用优惠码注册了一个JunGeHost.com,并且免费赠

4月底在NameCheap用优惠码注册了一个JunGeHost.com,并且免费赠送了一年的Positive SSL,于是顺便搞上SSL,这样传输数据也更加安全。SSL需要有一个独立IP,也就是一个独立IP只能对应一个SSL。(什么是SSL?)

一、准备工作

1、需要Nignx已经编译ssl 模块(lnmp一键安装包已经编译安装上),如果没有需要重新编译,方法可以参考Nginx无缝升级。

2、再NameCheap已注册/转移域名或购买主机产品,且购买是在购物车上添加了免费SSL。

二、使用OpenSSL生成证书 (注:一下蓝色加粗字为执行时输入的命令!)

1、生成RSA密钥

li88-99:~# cd /usr/local/nginx/conf/
li88-99:/usr/local/nginx/conf# openssl genrsa -out jungehost.pem 2048

Generating RSA private key, 2048 bit long modulus
.....+++
.+++
e is 65537 (0x10001)

2、生成一个证书请求

li88-99:/usr/local/nginx/conf# openssl req -new -key jungehost.pem -out jungehost.csr
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) [AU]:CN //输入国家简写
State or Province Name (full name) [Some-State]:ShanDong //省市
Locality Name (eg, city) []:JiNan                             //城市
Organization Name (eg, company) [Internet Widgits Pty Ltd]:JunGe Host   //组织名称或公司名称
Organizational Unit Name (eg, section) []:          //可以不用填
Common Name (eg, YOUR name) []:jungehost.com     //输入要配置ssl的域名,如jungehost.com,注意jungehost.com 和www.jungehost.com 属于不同的域名。
Email Address []:admin@jungehost.com                     //输入邮箱

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

按上面的注释输入相关信息后,会在目录下面生成jungehost.csr这个文件,执行cat jungehost.csr

将下面以—–BEGIN CERTIFICATE REQUEST—–开头到—–END CERTIFICATE REQUEST—–结尾的全部内容复制下来。需要使用这个jungehost.csr去NameCheap生成数字证书。

li88-99:/usr/local/nginx/conf# cat jungehost.csr
-----BEGIN CERTIFICATE REQUEST-----
MIIBzTCCATYCAQAwgYwxCzAJBgNVBAYTAkNOMREwDwYDVQQIEwhTaGFuRG9uZzEO
MAwGA1UEBxMFSmlOYW4xEjAQBeNVBAoTCUp1bkdlSG9zdDEOMAwGA1UECxMFanVu
Z2UxEjAQBgNVBAMTCVNoaUp1baBMaTEiMCAGCSqGSIbcDQEJARYTYWRtaW5AanVu
Z2Vob3N0LmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA0R9hda1NJdoO
2tbvHevVY3fdpdn8ESpSewHC9yc9zVoc0tz9Ww5EfpDV9L222xv/Z8DlDf2pUfIG
X7F15qIQJZ/VCUDNxS5Y7bjNTzduMq8yQnqkB6h/dpnlFTJlDQrAl6vaoOhBcB5L
hMLAQBf1V8800MIn3nfxb9E6aoydSk8CAwEAAaAAMA0GCSqGSIb3DQEBBQUAA4GB
AJxQOaFHra/ILos8+HO8Wn/2bhfWAUR4ovyRGKMB/n0BQlHPfNhKbILRv9KI5EUL
dc6HCf3AALetjNiPHrfpJOCj4Ljqchu3WeodthuwRd9hzhZHCf43UiopofbfRzMp
lmAJFuUwN93IgFSrslCh66JaQceNa5x/TQIsmviuKZGC
-----END CERTIFICATE REQUEST-----


延伸阅读:
nginx平台上运行PHP将会变得非常轻松

Tags: nginx   配置   NameCheap   SSL   C   免费  
PHP程序员站 Copyright © 2007-2010,PHPERZ.COM All Rights Reserved 粤ICP备07503606号