2016-8-16 09:35:19 @hury
参考:http://httpd.apache.org/docs/2.4/platform/windows.html#winsvc
##1、安装包:
httpd-2.4.23-x64.zip
VC9运行库_x86_x64.zip
2、安装httpd服务
2.1、默认安装
默认服务名:Apache2.4,默认配置文件:conf\httpd.conf
httpd.exe -k install
2.2、指定服务名安装
httpd.exe -k install -n "MyServiceName"
2.3、指定配置文件名
httpd.exe -k install -n "MyServiceName" -f "c:\files\my.conf"
2.4、卸载服务:
httpd.exe -k uninstall
httpd.exe -k uninstall -n "MyServiceName"
2.5、服务启动停止:
NET START Apache2.4
NET STOP Apache2.4
或者:
Windows服务管理
或者:
httpd.exe -k start -n "MyServiceName"
httpd.exe -k stop -n "MyServiceName"
httpd.exe -k shutdown -n "MyServiceName"
httpd.exe -k restart -n "MyServiceName"
2.6、测试服务
httpd.exe -n "MyServiceName" -t
默认账户:LocalSystem
2.7、网络资源访问配置
Alias "/images/" "Z:/"
Alias "/images/" "//imagehost/www/images/"
##3、配置实例
MRTG服务部署地址:D:\program\mrtg-2.17.4
MRTG监控结果地址:D:\program\mrtgdata
Apache服务部署地址:D:/program/Apache24
Web服务地址:D:\program\scm
3.1、修订配置文件httpd.conf
Define SRVROOT "D:/program/Apache24"
Listen 8001
3.2、添加别名
mrtgdata 用于存储mrtg监控结果
scm 用于通过web方式显示监控结果
Alias "/mrtgdata" "D:/program/mrtgdata"
Alias "/scm" "D:/program/scm"
<Directory "D:/program/mrtgdata">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
<Directory "D:/program/scm">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
3.3、添加 Apache 服务
rem 卸载服务
httpd.exe -k uninstall -n "scm-web"
pause
rem 安装服务
httpd.exe -k install -n "scm-web" -f "D:\program\Apache24\conf\scm-web.conf"
pause