Windows平台Apache 2.2.8+SSL安装

Windows平台Apache 2.2.8+SSL安装
www.apache.org上下载apache_2.2.8-win32-x86-openssl-0.9.8g.msi;
这是带有SSL版本的Apache,选择它就可以不用下载SSL的相关模块了。 【操作步骤】一. 安装Apache
按照提示安装,比较简单,安装完毕以后,在浏览器中输入Apache的IP地址或者域名,如果能够出现“It works!”(这是Apache默认的一个网页\htdocs\Index.html),说明安装Apache已经成功,这时已经可以提供默认为80端口的http服务了;
二. 配置文件修改:
成功安装了Apache以后,接下来需要对Apache的相关配置进行修改使其符合我们的相应需要。Apache的主要配置文件httpd.conf在Apache安装目录的conf文件夹中,默认安装路径为C:\Program Files\Apache Software Foundation\Apache2.2\conf,打开httpd.conf进行下列操作:
1. 去掉下面语句的注释,即去掉前面的#
#LoadModule ssl_module modules/mod_ssl.so 2. 去掉下面语句的注释,目的是使用Apache自带的ssl配置文件httpd-ssl.conf进行修改,减少我们的工作量。
#Include conf/extra/httpd-ssl.conf 三. 认证文件生成
1. 将conf目录下的openssl.cnf复制到bin目录下;
2. 在命令行下进入Apache安装目录下\bin文件夹,输入命令:
openssl req -new -out server.csr -config openssl.cnf 期间有些需要输入的地方分别如下:
Enter PEM pass phrase: (输入密码)
Verifying - Enter PEM pass phrase: (再次输入密码)
Country Name (2 letter code) [AU]: (国家缩写)
State or Province Name (full name) [Some-State]: (省名)
Locality Name (eg, city) []: (城市名)
Organization Name (eg, company) [Internet Widgits Pty Ltd]: (组织名或者公司名)
Organizational Unit Name (eg, section) []: (部门名)
Common Name (eg, YOUR name) []: (服务器域名或IP地址)
Email Address []: (邮件地址)
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []: (密码)
An optional company name []: (公司别名)
3. 生成私钥,输入命令:
openssl rsa -in privkey.pem -out server.key 4. 创建证书,输入命令:
openssl x509 -in server.csr -out server.crt -req -signkey server.key -days 3650 表示创建3650天有效的证书server.crt 5. 将\bin下面的 server.csr 、server.crt、server.key拷贝到httpd-ssl.conf中SSLCertificateFile和SSLCertificateKeyFile语句对应的目录下,例如若为下列路径则拷贝到conf文件夹下
SSLCertificateFile "D:/Program Files/Apache Software Foundation/Apache2.2/conf/server.crt"
SSLCertificateKeyFile "D:/Program Files/Apache Software Foundation/Apache2.2/conf/server.key" 6. 重启Apache服务器;
7. 用浏览器输入服务器IP地址或者域名,例如https:\\192.168.0.1,若出现“It works!”,则配置成功;
【相关说明】1. Apache无法成功运行的解决方法
在进行开始Apache时,若遇到Apache无法运行的情况,可以用开始菜单中Apache HTTP Server 2.2.6\Configure Apache Server\Test Configuration查找httpd.conf中的详细错误情况;
2. Apache服务器文件无法访问的解决方法
通过查看Apache安装目录下的logs文件夹内的access.log和error.log中的记录服务解决问题。
Tags: 

延伸阅读

最新评论

发表评论