【IT168 专稿】在上篇文章中(点击),介绍了SSL的基本概念及其工作流程。本篇继续介绍SSL的具体配置及应用。
四、为RHEL 4.0版本Linux的Apache服务器配置SSL
Apache服务器使用SSL时通常有两种选择,即主服务器或虚拟Web站点。首先看主服务器配置方法。
如果使用的是RHEL 3.0-4.0那么可以直接使用命令“rpm -qa | grep mod_ssl”检查,如果没有安装,可以以root 的身份登入系统,输入命令:“system-config-packages“。利用GUI 套件管理工具的网页服务器(见图5),点选「详细信息」,然后勾选「mod_ssl」,便会提示放入第二张光盘,便可完成安装工作。
![]() |
| 图5 安装mod_ssl 软件包 |
保护HTTP通讯:SSL的一个常见的用途是保护浏览器和网络服务器之间的网络HTTP通讯,但这并排除应用于不加保护的HTTP。其方法主要是,对普通HTTP加以SSL保护(称为HTTPS),但有一个重要的区别:它使用URL类型https而不是http ,而且使用不同的服务器端口(默认的是443)。mod_ssl为Apache网络服务器提供的功能主要就是这些了。
下面产生 SSL 凭证:使用以下命令可以产生 .key 和 .csr 文件:
# openssl genrsa -out server.key 1024
Generating RSA private key, 1024 bit long modulus
......++++++
........++++++
e is 65537 (0x10001)
# chmod 600 server.key
#openssl req -new -key server.key -out server.csr
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter ''.'', the field will be left blank.
-----
Country Name (2 letter code) [GB]:CN #两个字母的国家代号#
State or Province Name (full name) [Berkshire]:Beijing #省份名称#
Locality Name (eg, city) [Newbury]:beijing dax City #城市名称 #
Organization Name (eg, company) [My Company Ltd]:x41 #公司名称#
Organizational Unit Name (eg, section) []:x41 #组织名称#
Common Name (eg, your name or your server''s hostname) []:localhost #域名#
Email Address []:goodcjh@2911.net #Email地址#
Please enter the following ''extra'' attributes
to be sent with your certificate request
A challenge password []:goodcjh
An optional company name []:goodcjh
root#chmod 400 server.crt
