為您解碼網(wǎng)站建設(shè)的點(diǎn)點(diǎn)滴滴
發(fā)表日期:2018-09 文章編輯:小燈 瀏覽次數(shù):3949
下載得到的 www.domain.com.zip 文件,解壓獲得3個(gè)文件夾,分別是Apache、IIS、Nginx 服務(wù)器的證書文件,
Apache 2.x 證書部署(Apache/2.4.6 (CentOS))
<VirtualHost *:80> ServerName micocube.cn Redirect permanent / https://micocube.cn/ </VirtualHost>
編輯Apache根目錄下 conf.d/ssl.conf 文件,修改如下內(nèi)容: <VirtualHost 0.0.0.0:443> DocumentRoot "/var/www/html" ServerName www.domain.com SSLEngine on # 注意這幾個(gè)參數(shù)不能重復(fù),路徑不能寫錯(cuò) SSLCertificateFile "/usr/local/apache/conf/2_www.domain.com_cert.crt" SSLCertificateKeyFile "/usr/local/apache/conf/3_www.domain.com.key" SSLCertificateChainFile "/usr/local/apache/conf/1_root_bundle.crt" </VirtualHost>
配置完成后,重新啟動(dòng) Apache 就可以使用https://www.domain.com來訪問了。配置文件參數(shù)說明 SSLEngine on啟用SSL功能 SSLCertificateFile證書文件 SSLCertificateKeyFile 私鑰文件 SSLCertificateChainFile 證書鏈文件
Nginx 證書部署
server { listen 443; server_name www.domain.com; #填寫綁定證書的域名 ssl on; ssl_certificate 1_www.domain.com_bundle.crt; ssl_certificate_key 2_www.domain.com.key; ssl_session_timeout 5m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #按照這個(gè)協(xié)議配置 ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;#按照這個(gè)套件配置 ssl_prefer_server_ciphers on; location / { root html; #站點(diǎn)目錄 indexindex.html index.htm; } }
配置完成后,先用bin/nginx –t來測(cè)試下配置是否有誤,正確無誤的話,重啟nginx。就可以使用 https://www.domain.com 來訪問了。配置文件參數(shù)說明 listen 443SSL訪問端口號(hào)為443 ssl on啟用SSL功能 ssl_certificate 證書文件 ssl_certificate_key 私鑰文件 ssl_protocols 使用的協(xié)議 ssl_ciphers 配置加密套件,寫法遵循openssl標(biāo)準(zhǔn)
rewrite ^(.*) https://$host$1 permanent;
Tomcat 證書部署
獲取證書
如果申請(qǐng)證書時(shí)有填寫私鑰密碼,下載可獲得Tomcat文件夾,其中有密鑰庫(kù) www.domain.com.jks;
如果沒有填寫私鑰密碼,證書下載包的Tomcat文件夾中包括密鑰庫(kù)文件www.domain.com.jks 與密鑰庫(kù)密碼文件keystorePass.txt
當(dāng)用戶選擇粘貼CSR時(shí),不提供Tomcat證書文件的下載,需要用戶手動(dòng)轉(zhuǎn)換格式生成,操作方法如下:
可以通過 Nginx 文件夾內(nèi)證書文件和私鑰文件生成jks格式證書
轉(zhuǎn)換工具:https://www.trustasia.com/tools/cert-converter.htm
使用工具時(shí)注意填寫 密鑰庫(kù)密碼 ,安裝證書時(shí)配置文件中需要填寫。
證書安裝
配置SSL連接器,將www.domain.com.jks文件存放到conf目錄下,然后配置同目錄下的server.xml文件:
<Connector port="443" protocol="HTTP/1.1" SSLEnabled="true"maxThreads="150" scheme="https" secure="true"keystoreFile="conf/www.domain.com.jks"keystorePass="changeit"clientAuth="false" sslProtocol="TLS" />
注:
配置文件參數(shù)說明 clientAuth如果設(shè)為true,表示Tomcat要求所有的SSL客戶出示安全證書,對(duì)SSL客戶進(jìn)行身份驗(yàn)證 keystoreFile指定keystore文件的存放位置,可以指定絕對(duì)路徑,也可以指定相對(duì)于 (Tomcat安裝目錄)環(huán)境變量的相對(duì)路徑。 如果此項(xiàng)沒有設(shè)定,默認(rèn)情況下,Tomcat將從當(dāng)前操作系統(tǒng)用戶的用戶目錄下讀取名為 “.keystore”的文件。 keystorePass密鑰庫(kù)密碼,指定keystore的密碼。(如果申請(qǐng)證書時(shí)有填寫私鑰密碼,密鑰庫(kù)密碼即私鑰密碼, 否則填寫密鑰庫(kù)密碼文件中的密碼) sslProtocol 指定套接字(Socket)使用的加密/解密協(xié)議,默認(rèn)值為TLS
http自動(dòng)跳轉(zhuǎn)https的安全配置
到conf目錄下的web.xml。在</welcome-file-list>后面,</web-app>,也就是倒數(shù)第二段里,加上這樣一段
<login-config> <!-- Authorization setting for SSL --> <auth-method>CLIENT-CERT</auth-method> <realm-name>Client Cert Users-only Area</realm-name> </login-config> <security-constraint> <!-- Authorization setting for SSL --> <web-resource-collection> <web-resource-name>SSL</web-resource-name> <url-pattern>/*</url-pattern> </web-resource-collection> <user-data-constraint> <transport-guarantee>CONFIDENTIAL</transport-guarantee> </user-data-constraint> </security-constraint>
這步目的是讓非ssl的connector跳轉(zhuǎn)到ssl的connector去。所以還需要前往server.xml進(jìn)行配置:
<Connector port="8080" protocol="HTTP/1.1"connectionTimeout="20000"redirectPort="443" />
redirectPort改成ssl的connector的端口443,重啟后便會(huì)生效。
日期:2018-04 瀏覽次數(shù):7000
日期:2017-02 瀏覽次數(shù):3696
日期:2017-09 瀏覽次數(shù):3974
日期:2017-12 瀏覽次數(shù):3777
日期:2018-12 瀏覽次數(shù):5123
日期:2016-12 瀏覽次數(shù):4818
日期:2017-07 瀏覽次數(shù):13879
日期:2017-12 瀏覽次數(shù):3747
日期:2018-06 瀏覽次數(shù):4491
日期:2018-05 瀏覽次數(shù):4680
日期:2017-12 瀏覽次數(shù):3777
日期:2017-06 瀏覽次數(shù):4190
日期:2018-01 瀏覽次數(shù):4183
日期:2016-12 瀏覽次數(shù):4141
日期:2018-08 瀏覽次數(shù):4630
日期:2017-12 瀏覽次數(shù):3994
日期:2016-09 瀏覽次數(shù):6746
日期:2018-07 瀏覽次數(shù):3419
日期:2016-12 瀏覽次數(shù):3457
日期:2018-10 瀏覽次數(shù):3594
日期:2018-10 瀏覽次數(shù):3712
日期:2018-09 瀏覽次數(shù):3820
日期:2018-02 瀏覽次數(shù):3833
日期:2015-05 瀏覽次數(shù):3741
日期:2018-09 瀏覽次數(shù):3517
日期:2018-06 瀏覽次數(shù):3642
日期:2017-02 瀏覽次數(shù):4087
日期:2018-02 瀏覽次數(shù):4588
日期:2018-02 瀏覽次數(shù):4455
日期:2016-12 瀏覽次數(shù):3781
Copyright ? 2013-2018 Tadeng NetWork Technology Co., LTD. All Rights Reserved.