免安装版apache注册window服务

安装apache:
从官网下载apache2.2.29发现是免安装版的。首先就需要对apache注册服务
把apache拷贝到一个目录下,打开cmd
执行
httpd.exe -k install -n apache2


D:\tools\Apache22\bin>httpd.exe -k install -n apache2
Installing the apache2 service
The apache2 service is successfully installed.
Testing httpd.conf....
Errors reported here must be corrected before the service can be started.
httpd.exe: Syntax error on line 35 of D:/tools/Apache22/conf/httpd.conf: ServerR
oot must be a valid directory


出现error,提示ServerRoot目录错误,修改为conf/httpd.conf文件中ServerRoot 为"D:\tools\Apache22",apache所在的目录


再次执行httpd.exe -k install -n apache2发现
D:\tools\Apache22\bin>httpd.exe -k install -n apache2
[Mon Apr 20 16:07:54 2015] [error] apache2: Service is already installed.

该服务已存在
说明已经安装上了,刚才是测试报错。
下面开始启动apache
D:\tools\Apache22\bin>net start apache2
apache2 服务正在启动 .
apache2 服务无法启动。

又出现报错,说明配置文件还有错误。免安装版真费劲!
查看log,没有记录日志。只能删掉window的服务,再次安装查看错误
删除服务命令:
D:\tools\Apache22\bin>sc delete apache2
[SC] DeleteService 成功

再次安装:
D:\tools\Apache22\bin>httpd.exe -k install -n apache2
Installing the apache2 service
The apache2 service is successfully installed.
Testing httpd.conf....
Errors reported here must be corrected before the service can be started.
Syntax error on line 179 of D:/tools/Apache22/conf/httpd.conf:
DocumentRoot must be a directory

提示DocumentRoot错误
修改为conf/httpd.conf文件中DocumentRoot为 "D:\tools\Apache22\htdocs"


检查一下conf文件中是否还有别的这样路径的错误,有就修改过来
再次启动发现还有错误,重新安装服务:
D:\tools\Apache22\bin>httpd.exe -k install -n apache2
Installing the apache2 service
The apache2 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:/tools/Apache22/conf/extra/httpd-ahssl.conf:
SSLCertificateFile: file 'D:/Apache22/conf/ssl/server.crt' does not exist or is
empty

是ssl验证错误,从目录结构看,也是路径的问题,不过我这里暂时不需要ssl,这个模块用不到,就先注释掉。重新启动
D:\tools\Apache22\bin>net start apache2
apache2 服务正在启动 .
apache2 服务已经启动成功。

服务启动成功!
打开浏览器访问http://127.0.0.1(默认端口80)

出现一个apache的页面或者It works!则安装成功!


附;apache官网免安装版apache2.2.29 64位(最讨厌在blog里面balabala说一大堆,最后想下载的时候毛都找不到)


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值