1、第一步,先到Apache官网下载Apache文件
2、点击进入
3、继续
4、下载
5、将你的下载的压缩包解压到一个文件夹下,路径名不能有中文,然后找到httpd.conf文件
6、用编辑软件打开,这里笔者使用EditPlus记事本也可以
7、修改Define SRVROOT "D:/App/PHP/Apache24"ServerRoot "D:/App/PHP/Apache24"这里使用你安装的路径
8、修改Listen80 改为 Listen 8008因为端口为80的话可能会有冲突 8008可以自己定义如果想查看有哪些软件使用的端口是80可以在windows+R打开cmd输入 netstat -ano
9、找到DocumentRoot和锓旆痖颧Directory,他们的默认值是${SRVROOT}/htdocs修改为DocumentRoot "D:/App/PHP/Apache24/htdocs"<Directory "D:/App/PHP/Apache24/htdocs">
10、<Directory "${SRVROOT}/cgi-bin&孥恶膈茯quot;>修改为<Directory &鳎溻趄酃quot;D:/App/PHP/Apache24/cgi-bin">
11、将ScriptAlias /cgi-bin/ "${SRVROOT}/cgi-bin/"修改为 ScriptAlias /cgi-bin/ "D:/App/PHP/Apache24/cgi-bin/"
12、开启控制台:win+R 输入cmd命令行下进入到apache下面的bin目录,输入httpd -k install 把apache安装成windows后台服务。
13、在来检测一下文件是否配置正确如果你输入httpd -t 输出的是Syntax OK的话就说明成功了,否则!....
14、之后在你的安装盘比如笔者的D盘中Apache24文件中按住Shift键,同时单击鼠标右键,点击在此处打开命令窗口 cmd中输入"Apache24/bin/httpd.exe" -k install
15、这里我已经安装过,就会提示,已经安装过如果你是第一次安装,就会提示Installing the 'Apache2.4' serviceThe 'Apache2.4' service is successfully installedTesting httpd.conf...Errors reported here must be corrected before the servicecan be started
16、再来启动,双击
17、点击,点击Apache2.4 再点击Start,没报错就成功了!
18、大功告成之后就在浏览器的地址栏中输入:localhost:加上你设置的端口笔者是localhost:8008 按回车你看到的应该是Apache而不是错误页面
19、感谢你的浏览,如果觉得本经验对您有帮助的话,帮我点赞吧!有疑问可以告诉我