您现在的位置: 主页 > 上位机技术 > windows > apache/重装windows后如何修复apache2,并注册为系统服务
本文所属标签:
为本文创立个标签吧:

apache/重装windows后如何修复apache2,并注册为系统服务

来源:windows 网络用户发布,如有版权联系网管删除 2018-08-29 

  一般来说首次安装apache时建议安装到非windows系统所在分区,这样在windows崩溃重装后,可以不用再次进行“安装配置apache”这样重复性工作,而是直接重新注册apache为系统服务就很可以了。

  这里讲一下apache重新注册为系统服务的方法(这里以apache2.0.55 win32版为例说明)。

  软件的说明文档是很有用的东西,比用google在无数的结果里找寻更更准确;当然,很多软件尤其是自由软件free software多是英文文档,因此直接看文档常常会有一些难度。笔者的E文也不好,看还是尽量看一些英文文档,个人认为这是很有用的。

  apache安装目录里有bin/目录,apache的可执行程序就在这里,里面最主要的就是Apache.exe (某些版本可能是httpd.exe)

  查看apache.exe的帮助文档,在命令行里执行:

  httpd.exe -?

  得到如下的说明:

  D:Program FilesApache GroupApache2bin>Apache.exe -?
  Usage: Apache.exe [-D name] [-d directory] [-f file]
  [-C "directive"] [-c "directive"]
  [-w] [-k start|restart|stop|shutdown]
  [-k install|config|uninstall] [-n service_name]
  [-v] [-V] [-h] [-l] [-L] [-t] [-S]
  Options:
  -D name : define a name for use in <IfDefine name> 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
  -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 settings (currently only vhost settings)
  -S : a synonym for -t -D DUMP_VHOSTS
  -t : run syntax check for config files

  注意其中参数 -k install,就是注册为系统服务的,

  在命令行里执行

  D:Program FilesApache GroupApache2bin>Apache.exe -k install

  就可以了,执行完毕后,并没有消息提示,看到系统服务里可以看到 apache2 这样服务的存在.

  Apache.exe注册为windows服务时还可以使用以下参数:
  apache -k install -n "服务名"
  要安装一个使用特定配置的服务,安装时指定配置文件:
  apache -k install -n "服务名" -f "my serverconfmy.conf"
  要移除一个Apache服务,使用:
  apache -k uninstall -n "服务名"
  如果没有指定服务名,缺省地,将使用"Apache2"。

延伸阅读 



              查看评论 回复



嵌入式交流网主页 > 上位机技术 > windows > apache/重装windows后如何修复apache2,并注册为系统服务
 系统 文档 服务

"apache/重装windows后如何修复apache2,并注册为系统服务"的相关文章

网站地图

围观()