- 在同一 Web 主機上,設置加密與不加密兩類網站!
進階設定流程(一):
-
安裝 Apache 所需要的架密模組:
#yum -y install mod_ssl openssl
-
產生一張自我簽署的憑證
## 產生私鑰 #openssl genrsa -out ca.key 2048 ## 產生 CSR #openssl req -new -key ca.key -out ca.csr ## 產生自我簽署的金鑰 #openssl x509 -req -days 365 -in ca.csr -signkey ca.key -out ca.crt ## 複製檔案至正確位置 #cp ca.crt /etc/pki/tls/certs #cp ca.key /etc/pki/tls/private/ca.key #cp ca.csr /etc/pki/tls/private/ca.csr
-
處理 SELiux 設定:
#restorecon -RvF /etc/pki
-
設定成虚擬主機:
#vim /etc/httpd/conf.d/ssl_vhosts.conf LoadModule ssl_module modules/mod_ssl.so #Listen 443 <VirtualHost *:443> ServerName sec.example.com DocumentRoot /var/www/vhosts/sec SSLEngine on SSLCertificateFile "/etc/pki/tls/certs/ca.crt" SSLCertificateKeyFile "/etc/pki/tls/private/ca.key" </VirtualHost>
-
加密站台目錄與網頁的處理:
#mkdir -p /var/www/vhosts/sec #cd /var/www/vhosts/sec #vim index.html Hi~~This is a secrete site !!
- https://wiki.centos.org/zh-tw/HowTos/Https
- https://httpd.apache.org/docs/2.4/ssl/ssl_howto.html
- http://linux.vbird.org/linux_server/0360apache.php#www_basic_pkg