NC HTTPS 方案
目錄
Apache Http Server +NC集羣
方案: 在internet到Apach這段使用ssl,而從Apache到應用使用HTTP
系統環境:RedHat6.1+Apache http Server 2.2.15(系統自帶)
前提:NC集羣部署完成之後,然後進行HTTPS配置,採用Mod_jk方式進行負載均衡.
1. 軟件安裝
#install mod_ssl openssl
yum install mod_ssl openssl
2. 生成自簽字證書
# Generate private key
openssl genrsa -out ca.key 1024
# Generate CSR
openssl req -new -key ca.key -out ca.csr
Country Name (2 letter code) [AU]:CN ISO國家代碼(只支持兩位字符)
State or Province Name (full name) [Some-State]:JS所在省份
Locality Name (eg, city) []:WX所在城市
Organization Name (eg, company):HAOY1公司名稱
Organizational Unit Name (eg, section) []:HAOY1組織名稱
Common Name (eg, YOUR name) []:www.dh.com申請證書的域名
Email Address []:[email protected] 管理員郵箱
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []: 1234交換密鑰
An optional company name []: 注:Common Name必須和httpd.conf中server name必須一致,否則apache不能啓動 (啓動apache時錯誤提示爲:RSA server certificate CommonName (CN) `Kedou' does NOT match server name!? )
# Generate Self Signed Key
openssl x509 -req -days 365 -in ca.csr -signkey ca.key -out ca.crt
# Copy the files to the correct locations
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
3. 配置httpd.conf
#config httpd.conf
vi /etc/httpd/conf/httpd.conf
文件內容
Include conf/ncmodjk.conf //增加的
Include conf.d/*.conf
//文件尾增加
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
4. 配置ssl.conf
#congfig ssl.conf
vi /etc/httpd/conf.d/ssl.conf
文件內容
<VirtualHost *:443>
……
……
JKMountFile conf/ncmapping.properties //增加
SSLCertificateFile /etc/pki/tls/certs/ca.crt //注意修改路徑
SSLCertificateKeyFile /etc/pki/tls/private/ca.key //注意修改路徑
……
……
</VirtualHost>
IHS +WAS集羣
方案:在internet到IHS這段使用ssl,而從IHS到應用使用HTTP
前提:WAS集羣部署完成之後,然後進行HTTPS配置。
1. 創建CMS密鑰數據庫文件
打開IBM密鑰管理,“所有序 --> IBM HTTP Server V6.1 --> Start Key Management Utility ”,或者運行『IBM HTTP Server Instrall』\bin\ikeyman.bat
新建密鑰數據庫文件,選擇類型爲CMS。
點擊確定,然後輸入密碼,勾選“將密碼存儲到文件”。
2. 創建自簽署證書
點擊“創建 --> 新建自簽署證書”,輸入必要的信息,確定。
3. 使IHS支持SSL
打開『IBM HTTP Server Instrall』\conf\httpd.conf ,在文件底部加入如下代碼:
LoadModule ibm_ssl_module modules/mod_ibm_ssl.So
<IfModule mod_ibm_ssl.c>
Listen 443
<VirtualHost *:443>
SSLEnable
</VirtualHost>
</IfModule>
SSLDisable
KeyFile "『IBM HTTP Server Instrall』\Plugins\etc\key.kdb"
4. IHS到APP的傳輸使用http傳輸
打開plugin-cfg.xml文件,可以看到類似如下所示的server節點,
將其中的<Transport Hostname="wastest" Port="9443" Protocol="https">這個節點刪除,僅保留9080的http傳輸即可強制IHS到APP的傳輸使用http傳輸。
重啓IBM Http Server。