Windows搭建apache服务器

步骤说明

1、下载

Apache VS16 二进制文件和模块下载 (apachelounge.com)

根据电脑选择对应版本压缩包进行下载

2、解压安装包

解压到自定义的文件目录下

此处我解压至系统D盘根目录下

3、修改配置文件

D:\httpd-2.4.53-win64-VS16\Apache24\conf\http.conf

修改Define SRVROOT "D:/httpd-2.4.53-win64-VS16/Apache24"

将Define SRVROOT "C:/Apache24"修改成Define SRVROOT "D:/httpd-2.4.53-win64-VS16/Apache24"

4、运行服务器

双击D:\httpd-2.4.53-win64-VS16\Apache24\bin\httpd.exe

5、验证是否配置成功

打开浏览器,在地址栏输入本机IP地址

显示It works!

6、文件存放路径

D:\httpd-2.4.53-win64-VS16\Apache24\htdocs\

将文件存放至此目录下,用户可通过访问浏览器输入服务器IP地址下载所需文件

1、设置开机自动运行

命令行:httpd.exe -k install

2、运行报错。

D:\httpd-2.4.53-win64-VS16\Apache24\bin>httpd.exe

AH00558: httpd.exe: Could not reliably determine the server's fully qualified domain name, using ::1. Set the 'ServerName' directive globally to suppress this message

修改httpd-2.4.53-win64-VS16\Apache24\conf\http.conf文件

将#ServerName www.example.com:80修改成ServerName localhost:80

3、注意确保您已安装 Visual C++

操作系统64位:vc_redist_x64

操作系统32位:vc_redist_x86

参考文章

(66条消息) Windows 下Apache服务器搭建_sunqian666888的博客-CSDN博客_apache注册windows服务icon-default.png?t=M7J4https://blog.csdn.net/sunqian666888/article/details/78561399