search
尋找貓咪~QQ 地點 桃園市桃園區 Taoyuan , Taoyuan

Apache HTTPS啟用及安全性設定(CentOS) | KerKer 的模組世界

邊做邊學,順便留個筆記,若有錯誤請不指教。

本篇使用 CentOS7 及 apache2.4.6 版本實作。

本篇使用TWNIC現代化網路協定檢測工具測試:https://check.twnic.tw/

以下以TWNIC檢測工具項目逐條說明設定過程:

HTTPS狀態:

安裝mod_ssl及openssl

yum install mod_ssl openssl

重啟apache服務:

sudo service httpd restart

上傳憑證、中繼憑證及私鑰至伺服器

編輯 /etc/httpd/conf.d/ssl.conf 並於 標籤內加上(或修改)以下四行

SSLEngine on
SSLCertificateFile /yourpath/cert.pem
SSLCertificateKeyFile /yourpath/privkey.pem
SSLCertificateChainFile /yourpath/chain.pem

重啟apache服務:

sudo service httpd restart

HTTPS重導向:

編輯 /etc/httpd/conf/httpd.conf 於 標籤內加上三行:

RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://kerker.website %{REQUEST_URI} [R=301,L]

重啟apache服務:

sudo service httpd restart

HSTS:

編輯 /etc/httpd/conf.modules.d/00-base.conf 如果沒有下面這一行就把它加上去:

LoadModule headers_module modules/mod_headers.so

重啟apache服務:

sudo service httpd restart

編輯 /etc/httpd/conf/httpd.conf 於 標籤內加上一行:

LoadModule headers_module modules/mod_headers.so

編輯 /etc/httpd/conf.d/ssl.conf 同樣於 標籤內加上一行:

LoadModule headers_module modules/mod_headers.so

重啟apache服務:

sudo service httpd restart

TLS版本:

編輯 /etc/httpd/conf.d/ssl.conf 加上(或修改)一行:

SSLProtocol all -SSLv3 -TLSv1 -TLSv1

重啟apache服務:

sudo service httpd restart

加密演算法:

編輯 /etc/httpd/conf.d/ssl.conf 加上(或修改)一行:

SSLCipherSuite AES256+EECDH:AES256+EDH:AES128+EECDH:AES128+EDH

重啟apache服務:

sudo service httpd restart

SECURE RENEGOTIATION:

請將OpenSSL 更新至 0.9.8m 版本以上。

Certificate

本項檢查網站所使用之憑證是否符合規範,未符合規範者請自行更換符合規範之憑證。

  • trust chain of certificate:網站使用可信CA,可使用免費SSL憑證,如非營利組織網路安全研究小組( ISRG) 營運的Let’s Encrypt 憑證。
  • public key of certificate:金鑰長度2048位元。
  • signature of certificate:使用SHA256以上雜湊演算法。
  • domain name on certificate:使用的憑證網址與網站網址一致或使用Wildcard SSL 憑證,或使用Wildcard SSL 憑證。

相關



熱門推薦

本文由 KerKerwebsite 提供 原文連結

寵物協尋 相信 終究能找到回家的路
寫了7763篇文章,獲得2次喜歡
留言回覆
回覆
精彩推薦