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。