LinuxSSL證書安裝過程
SSL 證書安裝過程第一步:安裝mod_ssl[root@300second ~]# yum -y install mod_ssl第二步:HTTP 服務器上配置mod_ssl[1] 建立服務器密鑰[r
SSL 證書安裝過程
第一步:安裝mod_ssl
[root@300second ~]# yum -y install mod_ssl
第二步:HTTP 服務器上配置mod_ssl
[1] 建立服務器密鑰
[root@300second ~]# cd /etc/pki/tls/certs/ ← 進入HTTP 服務器配置文件所在目錄
[root@300second certs]# make server.key ← 建立服務器密鑰 umask 77 ;
/usr/bin/openssl genrsa -des3 1024 > server.key Generating RSA private key, 1024 bit long modulus ................ ...... e is 65537 (0x10001)
Enter pass phrase: ← 在這里輸入口令
Verifying - Enter pass phrase: ← 確認口令,再次輸入
[root@300second certs]# openssl rsa -in server.key -out server.key ← 從密鑰中刪除密碼(以避免系統(tǒng)啟動后被詢問口令)
Enter pass phrase for server.key: ← 輸入口令
writing RSA key
[2] 建立服務器公鑰
[root@300second certs]# make server.csr ← 建立服務器密鑰 umask 77 ;
/usr/bin/openssl req -utf8 -new -key server.key -out server.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) [GB]:CN ← 輸入國名 State or Province Name (full name) [Berkshire]:Fujian ← 輸入省名 Locality Name (eg, city) [Newbury]:Quanzhou ← 輸入城市名
Organization Name (eg, company) [My Company Ltd]:www.51cto.com ← 輸入組織名(任意)
,Organizational Unit Name (eg, section) []: ← 不輸入,直接回車
Common Name (eg, your name or your server's hostname) []:www.51cto.com ← 輸入通稱(任意)
Email Address []:300second@163.com ← 輸入電子郵箱地址 Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []: ← 不輸入,直接回車
An optional company name []: ← 不輸入,直接回車
[3] 建立服務器證書
[root@300second certs]# openssl x509 -in server.csr -out server.pem -req -signkey server.key -days 365 ← 建立服務器證書 Signature ok subject=/C=CN/ST=Fujian/L=Quanzhou/O=www.51cto.com/CN=www.51cto.com/emailAddress=300second@163.com
Getting Private key
[root@300second certs]# chmod 400 server.* ← 修改權限為400
[4] 設置SSL
[root@300second certs]# vi /etc/httpd/conf.d/ssl.conf ← 修改SSL 的設置文件
#DocumentRoot "/var/www/html" ← 找到這一行,將行首的“#”去掉
↓
DocumentRoot "/var/www/html" ← 變?yōu)榇藸顟B(tài)
[5] 重新啟動HTTP 服務,讓SSL 生效
[root@300second certs]# /etc/rc.d/init.d/httpd restart ← 重新啟動HTTP 服務器
停止 httpd: [ 確定 ]
啟動 httpd: [ 確定]
第三步:到StartSSL 申請免費證書: StartSSL 免費SSL 證書成功申請-HTTPS 讓訪問網(wǎng)站更安全
一、StartSSL 個人證書登錄申請
1、StartSSL 官網(wǎng):
,2、第一次用StartSSL ,先進入控制面板,先點擊注冊。
3、然后是填寫你的個人基本信息,以部落的經(jīng)驗,主要地址填寫詳細,StartSSL 會根據(jù)你的IP 自動填入你所在的地址。
4、提交后你的郵箱會收到一個驗證碼。
,5、用這個驗證碼輸入填寫驗證。
6、驗證成功后,要么是等待人工審核開通,要么是直接提示下載個人操作證書。
二、通過StartSSL 審核下載安裝個人操作證書
1、一般情況下幾分鐘后就可以收到StartSSL 審核通過的郵件了,沒有通過的話會問你一些問題,隨便回復一下就OK 了。像部落是直接開通,提示讓我下載證書。
,2、點擊安裝,稍等幾分鐘就會自動在瀏覽器上安裝StartSSL 操作證書了。
3、部落用了是Chrome 瀏覽器,提示安裝成功。
4、安裝好了個人操作證書后,就可以返回到控制面板,點擊Authenticate 憑證書登錄了。
三、StartSSL 免費SSL 通過域名驗證
,1、上面是獲得了StartSSL 的個人操作登錄使用權,接下來我們要用自己的域名來申請一個StartSSL 免費SSL 證書了。
2、點擊Validations Wizard,選擇Domain name validation,點擊Continue 。
3、輸入你想要使用SSL 的域名,點擊繼續(xù)。
4、接下來選擇你的域名所有者的郵箱,如果你的域名設置了Whois 保護,可能還要先進入域名注冊商那里取消保護,否則無法使用域名管理員郵箱通過域名所有權驗證。
,5、提交了域名后,到郵箱中收取激活郵件,填入驗證碼,通過驗證。
四、申請StartSSL 生成域名的SSL 證書
1、上面已經(jīng)提交了域名并通過了所有權驗證,點擊Certificates Wizard,選擇WEB Server SSL/TSL Certifites 。
2、生成私鑰,為私鑰提供一個密碼,最少10位,最大32位。
,3、將顯示內(nèi)容保存為freehao123.key (這個私鑰是加密的),繼續(xù)點擊下一步。
4、輸入你要綁定的二級域名,一般是www 。
5、提交后還得再等待StartSSL 審核,一般是幾分鐘后就可以收到郵件通知。當然也有審核不通過的,例如部落的因為域名的關系,直接被拒絕了,只好換一個域名了。The domain s0su.com could be easily
,mistaken with the domain sosu.com in which case our policy doesn’t allow it to be issued. Sorry for the inconvenience!
第四步:以下是在Linux 上配置過程: 1、修改httpd.conf 文件
**RPM安裝的情況下,不需要修改httpd.conf 文件,因為在httpd.conf 文件中默認添加了 include conf.d/*.conf。而在rpm 安裝時,conf.d 文件夾中已含有ssl.conf 文件。所以只要修改ssl.conf 文件就可以了。**
**RPM安裝的Apahce 時,可能一開始沒有mod-ssl ,需要安裝。方法為:yum install mod_ssl 或者用rpm 包安裝,需要mod_ssl arp_util distcache httpd postgresql-libs等伊來關系。**
需要修改時可在httpd.conf 文件中加上include conf.d/ssl.conf(用于ssl 模塊使用的conf 文件的路徑即可) 。
2、修改ssl.conf 文件
[root@localhost conf.d]#cp -p ssl.conf ssl.conf.bk
[root@localhost conf.d]#vi ssl.conf
---------------------------------------
Listen 443 //可以改成其他端口
SSLPassPhraseDialog builtin //每次重啟Apache 時需要輸入密碼
SSLSessionCache shmcb:/var/cache/mod_ssl/scache(512000)
SSLSessionCacheTimeout 300
SSLMutex default
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
SSLEngine on
SSLCertificateFile /etc/httpd/conf/ssl.crt/server.crt(在startssl 申請的crt ,將文件copy 到對應的文件夾下)
SSLCertificateKeyFile /etc/httpd/conf/ssl.crt/server.key(在startssl 申請的key 將文件copy 到對應的文件夾下)
SSLCACertificateFile /etc/httpd/conf/ssl.crt/ca.crt //雙向時使用
SSLVerifyClient require //雙向時使用, 強制客戶必須持有SSL 證書請求
SSLVerifyDepth 10 //雙向時使用
,3、重啟Apache
[root@localhost ssl.crt]#service httpd restart
此時可能需要密碼:此時密碼就是你在申請證書時,生成私鑰時輸入的密碼。
4、開啟防火墻端口