/ VMware

VMware 占用443端口导致 Apache 无法启动

在笔记本上安装 VMware Workstation 之后,发现 Apache httpd 服务无法启动。错误日志如下:

09:14:35  [Apache] 	Attempting to start Apache app...
09:14:36  [Apache] 	Status change detected: running
09:14:39  [Apache] 	Status change detected: stopped
09:14:39  [Apache] 	Error: Apache shutdown unexpectedly.
09:14:39  [Apache] 	This may be due to a blocked port, missing dependencies, 
09:14:39  [Apache] 	improper privileges, a crash, or a shutdown by another method.
09:14:39  [Apache] 	Press the Logs button to view error logs and check
09:14:39  [Apache] 	the Windows Event Viewer for more clues
09:14:39  [Apache] 	If you need more help, copy and post this
09:14:39  [Apache] 	entire log window on the forums

Google 搜索关键词 Apache shutdown unexpectedly,看到 stackoverflow 上的一个讨论后,基本确定问题是 Apache 的某个默认端口被其他进程占用。Apache 的默认端口包括80443,可以在cmd中查看这两个端口的占用情况,输入命令:

netstat -aon

可以看到443端口被8584进程占用(ipv4和ipv6都有):

Proto  Local Address          Foreign Address        State           PID
...
TCP    127.0.0.1:443          127.0.0.1:1222         ESTABLISHED     8584
TCP    127.0.0.1:443          127.0.0.1:10534        ESTABLISHED     8584
...
TCP    [::]:443               [::]:0                 LISTENING       8584
...

给任务管理器加上进程ID(PID)这一列,可以看到,8584进程为 vmware-hostd.exe

在任务管理器中查看PID为 8584 的进程

这个问题可以通过修改 Apache 的监听端口来解决,443 是 Apache 默认的 SSL 端口。打开httpd-ssl.conf,找到#Listen 443这一行,将443改为其他端口号,如7331,重启httpd服务,done!