CentOS 6.5系統LNMP環境安裝SSL認證

來源:互聯網
上載者:User

本文轉載自:https://typecodes.com/web/lnmppositivessl.html


SSL認證的安裝跟部落格程式(不管是wordpress或者typecho等等)無關,只是跟伺服器的類型(比如Nginx、Apache或者IIS等)有關。

----------操作說明----------               系統:            阿里雲CentOS 6.5環境:            LNMP(只需配置Nginx伺服器就行)操作工具:        SecureCRT 7.0部落格程式:        Typecho 14.10SSL認證供應商:    PositiveSSL from Namecheap
一、在web伺服器上產生私密金鑰、CSR簽章要求檔案
###### 1 產生2048bit的RSA私密金鑰檔案typecodes.key[root@typecodes ssl]# openssl genrsa -des3 -out typecodes.key 2048Generating RSA private key, 2048 bit long modulus.......................+++...............+++e is 65537 (0x10001)Enter pass phrase for typecodes.key:Verifying - Enter pass phrase for typecodes.key:  [輸入兩次相同的密碼]###### 2 產生CSR認證簽章要求檔案typecodes.csr [root@typecodes ssl]# openssl req -new -key typecodes.key -out typecodes.csrEnter pass phrase for typecodes.key:    [輸入之前的密碼]You are about to be asked to enter information that will be incorporatedinto 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 blankFor some fields there will be a default value,If you enter '.', the field will be left blank.-----Country Name (2 letter code) [XX]:CN    [國籍]State or Province Name (full name) []:GuangDong [省份]Locality Name (eg, city) [Default City]:ShenZhen    [城市]Organization Name (eg, company) [Default Company Ltd]:TypeCodes.com [公司]Organizational Unit Name (eg, section) []:TypeCodes.com [行業]Common Name (eg, your name or your server's hostname) []:TypeCodes.com  [自己的網域名稱]Email Address []:vfhky@typecodes.comPlease enter the following 'extra' attributesto be sent with your certificate requestA challenge password []:    [這裡不填]An optional company name []:    [這裡不填]###### 3 去掉密鑰檔案typecodes.key的密碼  【強烈推薦】 [root@typecodes ssl]# cp typecodes.key typecodes.key.origin[root@typecodes ssl]# openssl rsa -in typecodes.key.origin -out typecodes.keyEnter pass phrase for typecodes.key.origin:writing RSA key [輸入之前的密碼]###### 4 當然也可用openssl通過私密金鑰和CSR自己產生簽名檔案,但是可能不被瀏覽器認可,所以本步驟應該跳過 [root@typecodes ssl]# openssl x509 -req -days 365 -in typecodes.csr -signkey typecodes.key -out typecodes.crtSignature oksubject=/C=CN/ST=GuangDong/L=ShenZhen/O=TypeCodes.com/OU=TypeCodes.com/CN=TypeCodes.com/emailAddress=vfhky@typecodes.comGetting Private key###### 5 查看上面4個步驟所產生的檔案,其中typecodes.crt是不需要的[root@typecodes ssl]# lstypecodes.crt  typecodes.csr  typecodes.key  typecodes.key.origin
二、擷取SSL認證供應商發放的數位憑證

首先進入Namecheap的SSL認證管理介面,然後點擊“Active Now”按鈕準備購入SSL產品。這時會進入“Digital Certificate Order Form”頁面,根據自己的web伺服器類型在“Select Web Sever”中選擇,博主的是Nginx。接著在SecureCRT終端上執行命令 [root@typecodes ssl]# cat typecodes.csr ,然後複製從-----BEGIN CERTIFICATE REQUEST----- 到 -----END CERTIFICATE REQUEST----- 中的所有內容再粘貼到“Enter csr”下面的空白欄中。

最後點擊“Next”,這時的介面會顯示你的網域名稱Whois資訊上的相關郵箱地址清單,你需要選擇能正常接收驗證碼的網域名稱郵箱(注意:使用了第三方如QQ企業郵箱等,在頁面是不能顯示出來的)。填寫完使用者的相關資訊(像城市名、街道名等等盡量使用英文,中文可能會出錯)後,Namecheap會發一封有驗證碼的郵件到你選擇的網域名稱郵箱中,進入郵箱點擊“here”按鈕,然後輸入驗證碼即可完成SSL訂單。這時,Namecheap會把PositiveSSL認證檔案通過郵件發送到自己的郵箱發送認證郵件。

三、設定管理員中Nginx檔案

SSL認證供應商會在郵件中提供我們需要的四個.crt檔案:網域名稱認證檔案typecodes_com.crt、COMODORSADomainValidationSecureServerCA.crt、

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.