Win7系统64位环境下使用Apache——Apache2.2安装及常见问题解决

本文详细介绍了在Windows 7 64位环境下安装Apache的过程,包括解决安装过程中遇到的各种错误,如权限问题、配置文件错误等,并最终实现通过浏览器访问Apache服务器。

转载请注明出处:http://blog.csdn.net/dongdong9223/article/details/64921439
本文出自【我是干勾鱼的博客

之前在《Win7系统64位环境下安装Apache——下载Apache》中讲述了如何下载Apache。下载完了就该安装了,这篇文章来讲一下如何在win7环境下安装Apache。

下载下来的文件如下:

这里写图片描述

解压缩之后放到一个合适的目录下,比如Apache放在:

D:\Studying\apache\httpd-2.2.32-x64-r1\Apache22

下,这时候要修改:

D:\Studying\apache\httpd-2.2.32-x64-r1\Apache22\conf\httpd.conf

文件,将ServerRoot设置为:

ServerRoot "D:\Studying\apache\httpd-2.2.32-x64-r1\Apache22"

也就是设置Apache的安装路径。

在cmd中运行:

httpd.exe -k install -n apache

如图:

这里写图片描述

这里报错:

(OS 5)拒绝访问。 : Failed to open the WinNT service manager

是因为启动cmd窗口的时候没有使用管理员权限,现在使用管理员权限启动cmd窗口,如图:

这里写图片描述

接着在运行:

httpd.exe -k install -n apache

这时候会报错:

Errors reported here must be corrected before the service can be started.
Syntax error on line 179 of D:/Studying/apache/httpd-2.2.32-x64-r1/Apache22/conf/httpd.conf:
DocumentRoot must be a directory

如图所示:

这里写图片描述

其中语句:

Errors reported here must be corrected before the service can be started.

的意思是安装后如果有错误需要将错误修改,整个安装才能成功。这里就报了个错。需要再次修改:

D:\Studying\apache\httpd-2.2.32-x64-r1\Apache22\conf\httpd.conf

修改DocumentRoot的值为:

DocumentRoot "D:\Studying\apache\httpd-2.2.32-x64-r1\Apache22/htdocs"

再次运行安装命令:

httpd.exe -k install -n apache

又报个错,说软件已经安装过了,如图:

这里写图片描述

需要先卸载,运行命令:

sc delete apache

如图:

这里写图片描述

后面就要注意了,之后每次如果安装出错,都需要先卸载,再执行安装命令。

再次进行安装,结果又报了错:

D:\Studying\apache\httpd-2.2.32-x64-r1\Apache22\bin>httpd.exe -k install -n apache
Installing the apache service
The apache service is successfully installed.
Testing httpd.conf….
Errors reported here must be corrected before the service can be started.
Syntax error on line 110 of D:/Studying/apache/httpd-2.2.32-x64-r1/Apache22/conf/extra/httpd-ahssl.conf:
SSLCertificateFile: file ‘D:/Apache22/conf/ssl/server.crt’ does not exist or is empty

如图:

这里写图片描述

参考了网上的一些说法:

http://www.server110.com/apache/201404/9462.html

还有:

http://bbs.csdn.net/topics/391855347

其实注释掉:

D:\Studying\apache\httpd-2.2.32-x64-r1\Apache22\conf\httpd.conf

文件中的:

LoadModule ssl_module modules/mod_ssl.so

就可以,如图:

这里写图片描述

这条语句需要注释掉。

先卸载Apache,再次安装,如图:

这里写图片描述

这次安装成功了。

双击:

D:\Studying\apache\httpd-2.2.32-x64-r1\Apache22\bin

目录下的:

ApacheMonitor.exe

文件,如图:

这里写图片描述

这时候会弹出Apache服务监控器,如图:

这里写图片描述

点击start,但是这时候,在浏览器中输入:

http://localhost

会出现:

这里写图片描述

这时候又要修改文件:

D:\Studying\apache\httpd-2.2.32-x64-r1\Apache22\conf\httpd.conf

如图:

这里写图片描述

将这部分的:

Deny from all

改为:

Allow from all

就可以了。

点击Restart,如图:

这里写图片描述

再次在浏览器中输入:

http://localhost

显示如图:

这里写图片描述

至此安装成功!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值