Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> 電腦軟體教學 >> 伺服器技術 >> 關於伺服器

Apache2 服務啟動失敗「服務性錯誤 1 (0x1)」排查與解決

編輯:關於伺服器

錯誤現象

安裝完成後啟動 Apache 服務失敗,Windows 事件檢視器記錄多條錯誤:

  • Unable to open logs
  • Warning: DocumentRoot [F:/var/www/fanjiexi] does not exist
  • no listening sockets available, shutting down

核心原因

最關鍵的是 「no listening sockets available」,通常表示預設監聽埠 80 被佔用 (常見於 IIS、Skype、VMware 等佔用 80 埠)。

解決方案

方法一:釋放 80 埠 (推薦)

  1. 以管理員身分執行 CMD:
    netstat -ano | findstr :80 找出佔用進程 PID。
  2. 任務管理器 → 詳細資料 → 找到對應 PID → 結束進程 (或修改該程式設定不佔用 80 埠)。
  3. 重新啟動 Apache 服務。

方法二:修改 Apache 監聽埠

編輯 httpd.conf:

# 將 Listen 80 改為未被佔用的埠,如 8080
Listen 8080

同時修改 ServerName:
ServerName localhost:8080

重啟服務後以 https://localhost:8080 存取。

附帶修正:DocumentRoot 路徑不存在

確認 httpd.conf 中 DocumentRoot 指向的目錄實際存在,否則建立或修正路徑。

Copyright © Windows教程網 All Rights Reserved