You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu 18.04安装XAMPP后Apache无法启动:提示已有Web服务器运行

解决XAMPP Apache无法启动:端口被Nginx占用的问题

嘿,从你提供的netstat -tuplen输出结果就能精准定位问题啦:你的80端口已经被Nginx的master进程占用,这就是XAMPP的Apache启动失败的核心原因——同一端口不能被多个网络服务同时监听。

下面给你两种可行的解决办法,你可以根据自己的需求选择:

方法一:停止Nginx服务,让XAMPP Apache使用默认80端口

如果你暂时不需要运行Nginx,可以直接停止它,然后重启XAMPP的Apache:

  • 停止当前运行的Nginx服务:
    sudo systemctl stop nginx
    
  • (可选)如果不想让Nginx随系统自动启动,执行:
    sudo systemctl disable nginx
    
  • 最后重启XAMPP的Apache服务:
    sudo /opt/lampp/lampp restart apache
    

方法二:修改XAMPP Apache的监听端口,实现Nginx与Apache共存

如果你需要同时运行Nginx和XAMPP的Apache,可以修改Apache的监听端口来避免冲突:

  1. 打开XAMPP的Apache主配置文件:
    sudo nano /opt/lampp/etc/httpd.conf
    
  2. 在文件中找到以下两行内容:
    Listen 80
    ServerName localhost:80
    
    将其中的80替换为一个未被占用的端口(比如8080):
    Listen 8080
    ServerName localhost:8080
    
  3. (如果使用HTTPS)修改SSL端口,打开SSL配置文件:
    sudo nano /opt/lampp/etc/extra/httpd-ssl.conf
    
    找到Listen 443和<VirtualHost _default_:443>,将443替换为另一个端口(比如4433):
    Listen 4433
    <VirtualHost _default_:4433>
    
  4. 保存并退出编辑器后,重启XAMPP服务:
    sudo /opt/lampp/lampp restart
    
    之后访问XAMPP主页时,需要使用新的端口地址:http://localhost:8080(HTTP)或https://localhost:4433(HTTPS)。

内容的提问来源于stack exchange,提问作者RexSolus

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 03:23:51