Apache Http Server2.4的常用命令及安装步骤

来源:互联网 发布:mac desktop pictures 编辑:程序博客网 时间:2024/06/16 14:58

软件: httpd-2.4.25-x86-vc11-r1.zip

常用命令:

1.httpd.exe -h  查看帮助
2.httpd.exe -k install (-n ServiceName)  注册安装该服务,取名为ServiceName,如果不加-n则默认命名
3.httpd.exe -k uninstall (-n ServiceName)  卸载删除该服务
4.sc delete ServiceName  使用windows命令删除服务
5.httpd.exe -k start (-n ServiceName)  # 也可使用windows自带的services工具,也可使用ApacheMonitor.exe。
6.httpd.exe -k restart (-n ServiceName)
7.httpd.exe -k stop|shutdown (-n ServiceName)


安装步骤:
1.将httpd.conf中的SRVROOT修改为自己的路径,要用/,不能用\,例如
Define SRVROOT "D:/Software/httpd-2.4.25-x86-vc11-r1/Apache24"

2.将httpd.conf中的Listen 修改为可用的端口号,例如
Listen 8088
ServerName localhost:8080

3.注册服务并且启动。

4.测试是否成功,输入http://localhost:端口号/

5.参考
http://jingyan.baidu.com/article/d8072ac47baf0eec95cefdca.html
http://jingyan.baidu.com/article/64d05a025cdf69de55f73be5.html
http://www.cnblogs.com/mingforyou/archive/2013/01/26/2878129.html

apache http server 2.2 安装常见问题http://blog.csdn.net/dongdong9223/article/details/64921439


配置CGI
cgi-bin的目录可以自己配置
1.ScriptAlias /cgi-bin/ "${SRVROOT}/cgi-bin/"
2.<Directory "${SRVROOT}/cgi-bin">
    AllowOverride None
    Options +ExecCGI  
    Require all granted
</Directory>
3.AddHandler cgi-script .cgi .pl .py
4.测试python脚本
#!C:\Python27\python.exe
# -*- coding: UTF-8 -*-
print "Content-type:text/html"
print  # 必须有空行
print '<html>'
print '<head>'
print '<meta charset="utf-8">'
print '<title>asfd</title>'
print '<body><h1>hello, world</body>'
print '</head>'
print '</html>'






原创粉丝点击