1.安装程序及服务名
httpd -k install -n Apache2.4
安装成功后,会提示如下异常:
Testing httpd.conf....
Errors reported here must be corrected before the service can be started.
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::14ea:32a2:9c1d:bc74. Set the 'ServerName' directive globally to suppress this message
找到安装目录下的Apache24\conf\httpd.conf文件,找到219行,修改名称如下:
ServerName localhost:80
同时修改以下几处配置:
第38行修改为
ServerRoot "安装的根目录"
如:ServerRoot "c:/apache_httpd_server_x64/Apache24"
第244,245行, 修改为
DocumentRoot "c:/apache_httpd_server_x64/Apache24/htdocs"
<Directory "c:/apache_httpd_server_x64/Apache24/htdocs">
第363行修改为
ScriptAlias /cgi-bin/ "c:/apache_httpd_server_x64/Apache24/cgi-bin/"
测试配置文件的语法是否正确:
httpd -n Apache2.4 -t
如果返回 Syntax OK,则表示没有语法错误,则可以直接运行以下命令,启动服务:
httpd -k start
如果出现异常,则按提示的错误信息进行修改。