[Apache] Problem detected!
[Apache] Error: Apache shutdown unexpectedly.
Apache 默认监听的端口是 80和 443。如果这些端口被其他程序占用,Apache 就无法启动。常见的占用端口的程序包括:
-
World Wide Web Publishing Service(IIS):这是 Windows 系统自带的 Web 服务器,可能默认占用了 80 端口。
-
VMware Workstation:可能占用 443 端口。(图上和示例都默认端口被vm虚拟机占用)
-
Skype:默认可能占用 80 和 443 端口。
-
SQL Server Reporting Service:也可能占用 80 端口
-
解决方法:
-
检查端口占用情况:在命令提示符中输入以下命令查看端口占用情况:
netstat -ano | findstr :80 netstat -ano | findstr :443
找到占用端口的进程 ID(PID),然后在任务管理器中结束该进程。
-
修改 Apache 的监听端口:如果无法结束占用端口的进程,可以修改 Apache 的配置文件来更改监听端口。
-
修改
httpd.conf
文件中的Listen 80
为其他端口,例如Listen 8080
。 -
修改
httpd-ssl.conf
文件中的Listen 443
为其他端口,例如Listen 4433
。 修改完成后,重启 Apache 服务。
-
进入设置页
更改端口 并保存
打开 你xampp安装的位置\xampp\apache\conf\httpd.conf并找到Listen 80和ServerName localhost:80将其后面的数字改为没有被占用的端口
Listen 80
Listen 8080
ServerName localhost:80
ServerName localhost:8080
以及(你安装xampp的盘符地址):\xampp\apache\conf\extra\httpd-ssl.conf并找到Listen 443将其后面的数字改为没有被占用的端口
Listen 443
保存并退出后就可以开启Apache之旅了