Apache 與 IIS 默認均監聽 80 端口,共存必衝突。本文提供雙向修改端口方案,並附帶 `netstat`+`tasklist` 定位佔用 80 端口進程的通用排查技巧。
httpd.conf(通常在 Apache安裝目錄/conf/)。Listen 80,改為 Listen 81。Listen 82 等。netstat -aon | findstr "80"TCP 127.0.0.1:80 0.0.0.0:0 LISTENING 2448(PID=2448)。tasklist | findstr "2448"thread.exe 2448 ...taskkill /PID 2448 /F 結束進程。httpd.exe: Could not reliably determine the server's fully qualified domain name...
在 httpd.conf 首行添加:ServerName localhost:80 即可消除警告(無需配置 DNS)。
最佳實踐:生產環境建議 Apache 走 80/443,IIS 走 81/444 或反向代理模式(Nginx/IIS ARR 做前端分發),避免端口佔用與維護混淆。