下载地址
https://www.apachelounge.com/download/
1、 解压到指定目录例如(E:\Program Files (x86)\Apache)
2、 打开…/Apache/conf文件夹下的httpd.conf文件,如图修改成你自己apache的绝对路径:如图
3、 如果80端口被占用修改默认端口(没有跳过此步)
4、 以管理员身份打开cmd命令行窗口:进入你Apache安装目录下的bin文件夹
cd /d E:\Program Files (x86)\Apache\Apache24\bin
然后输入命令:httpd -k install进行安装apache服务器,如果报错在服务里启动apache。
警告:AH00558: httpd: Could not reliably determine the server’s fully qualified domain name, using localhost.localdomain. Set the ‘ServerName’ directive globally to suppress this message。
把配置文件httpd.conf中的 ServerName 改成可用域名ServerName localhost:80(与修改的默认端口一致)
5、 启动Apache服务:httpd -k start
6、 停止Apache服务:httpd -k stop
7、 卸载Apache服务:sc delete Apache2.4
8、 其他报错:
过程中可能会出现的问题及解决办法:
1、出错信息:ServerRoot must be a valid directory
解决方法:打开\Apache24\conf\httpd.conf,搜索Define SRVROOT,把后面的地址改成Apache绝对地址。
2、出错信息:AH00072: make_sock: could not bind to address [::]:80
解决方法:打开\Apache24\conf\httpd.conf,搜索Listen,把Listen后面的80改为8080,出错是因为80端口被占用。
3、出错信息:AH00072: make_sock: could not bind to address [::]:443
解决方法:打开\Apache24\conf\extra\httpd-ahssl.conf,搜索Listen,把Listen后面的443改为442。打开\Apache24\conf\extra\httpd-ssl.conf,搜索Listen,把Listen后面的443改为442。同样是端口占用的问题。
4、查看某个端口:netstat -ano | findstr “8080”
5、结束进程:taskkill /pid 18404 /f (/f强制结束)