在注册服务成功后,在命令行使用 httpd -k start 会说找不到这个服务,好奇怪,应为我注册服务的时候是写的 httpd -k install -n Apache2.47 成功注册系统服务,但却找不到
C:\Users\ccsec>httpd -k restart
[Sun May 23 10:44:51.159016 2021] [mpm_winnt:error] [pid 5200:tid 456] (OS 2)系统找不到指定的文件。 : AH00436: No installed service named "Apache2.4".
反复验证后发现 注册httpd -k install -n Apache2.4 就可以找到服务。好吧
D:\Win10-IT\Apache-2.4.47-vs16\bin>sc delete Apache2.47
[SC] DeleteService 成功
#删除不对的服务名重新注册 Apache2.4
D:\Win10-IT\Apache-2.4.47-vs16\bin>httpd -k install -n Apache2.4
Installing the 'Apache2.4' service
The 'Apache2.4' service is successfully installed.
Testing httpd.conf....
Errors reported here must be corrected before the service can be started.
#上面的errors 可以忽略,查过些资料认为只是提升作用
#再次启动好了不报错了
C:\Users\ccsec>httpd -k restart
C:\Users\ccsec>
大概在 httpd -k 的逻辑代码里给写定了是 Apache2.4 。。。