Windows下安装Apache服务器(httpd)
Apache服务器的安装分为两种:
安装包版本的安装
压缩包版本的安装
下载完成后解压压缩包,在DOS窗口中运行httpd -h可以查看到如下帮助信息
Usage: C:\\Users\\Administrator\\Documents\\Apache24\\bin\\httpd.exe [-D name] [
-d directory] [-f file]
[-C "directive"]
[-c "directive"]
[-w] [-k start|re
start|stop|shutdown] [-n service_name]
[-k install|confi
g|uninstall] [-n service_name]
[-v] [-V] [-h] [-
l] [-L] [-t] [-T] [-S] [-X]
Options:
-D name : define a name for use in directives
-d directory : specify an alternate initial ServerRoot
-f file : specify an alternate ServerConfigFile
-C "directive" : process directive before reading config files
-c "directive" : process directive after reading config files
-n name : set service name and use its ServerConfigFile and ServerR
oot
-k start : tell Apache to start
-k restart : tell running Apache to do a graceful restart
-k stop|shutdown : tell running Apache to shutdown
-k install : install an Apache service
-k config : change startup Options of an Apache service
-k uninstall : uninstall an Apache service
-w : hold open the console window on error
-e level : show startup errors of level (see LogLevel)
-E file : log startup errors to file
-v : show version number
-V : show compile settings
-h : list available command line options (this page)
-l : list compiled in modules
-L : list available configuration directives
-t -D DUMP_VHOSTS : show parsed vhost settings
-t -D DUMP_RUN_CFG : show parsed run settings
-S : a synonym for -t -D DUMP_VHOSTS -D DUMP_RUN_CFG
-t -D DUMP_MODULES : show all loaded modules
-M : a synonym for -t -D DUMP_MODULES
-t : run syntax check for config files
-T : start without DocumentRoot(s) check
-X : debug mode (only one worker, do not detach)
运行httpd -k install来安Apache服务
出现 The 'Apache2.4' service is successfully installed. 表示已经安装成功
但是现在还无法启动,还需要修改配置文件 httpd.conf 设置ServerRoot目录,如下: 将/Apache24改为自己对应的目录C:/Users/Administrator/Documents/Apache24
38 Define SRVROOT "C:/Users/Administrator/Documents/Apache24"
修改完成后试试服务器可以启动了不?
在DOS窗口中运行net start Apache2.4启动Apache服务
可以试着在浏览器中访问:http://localhost/,看看是否出现Apache欢迎页面
到此,服务器安装就已经完成了---
下载Apache对应的版本的组件
下载完成解压后将放mod_h264_streaming.so到Apache的modules目录中去
然后再次修改httpd.conf配置文件
LoadModule h264_streaming_module modules/mod_h264_streaming.so
AddHandler h264-streaming.extensions .mp4
将上面内容添加到httpd.conf配置文件中去
OK
我们再次启动Apache服务 net start Apache2.4
O NO
需要先停止Apache服务后才能再次启用,运行net stop Apache2.4来停止Apache服务