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

安卓设备连接XAMPP服务器部分站点不可用,提示net::ERR_CONNECTION_REFUSED求助

Hey there, let's troubleshoot this net::ERR_CONNECTION_REFUSED issue step by step—since one site works fine, we know the core network setup is partially functional, so we can narrow down the causes quickly.

1. Check the Problematic Site's Directory & Apache Configuration

First, let's confirm your mysite is set up correctly in XAMPP:

  • If you're using virtual hosts, open httpd-vhosts.conf (usually located at xampp/apache/conf/extra/) and verify the <VirtualHost> block for mysite includes proper access permissions for your local network. Here's a working example:
    <VirtualHost *:80>
        DocumentRoot "C:/xampp/htdocs/mysite"
        ServerName mysite.local
        <Directory "C:/xampp/htdocs/mysite">
            AllowOverride All
            Require all granted
        </Directory>
    </VirtualHost>
    
  • If you're not using virtual hosts, ensure mysite is directly inside XAMPP's htdocs folder (e.g., xampp/htdocs/mysite). Also, check folder permissions:
    • On Windows: Right-click the mysite folder → Properties → Security → Confirm your user account has read/write access.
    • On macOS/Linux: Run sudo chmod -R 755 /opt/lampp/htdocs/mysite to set universal read/execute permissions.
2. Verify Apache's Network Listening & Firewall Settings

A common culprit here is Apache only listening to localhost, or firewalls blocking the connection:

  • Open httpd.conf (in xampp/apache/conf/) and check the Listen directive—it should be Listen 80 (not Listen 127.0.0.1:80), which lets Apache accept connections from any device on your local network.
  • Firewall checks:
    • Windows: Go to Windows Defender Firewall → Allow an app through firewall → Ensure "Apache HTTP Server" is allowed for private networks.
    • macOS: System Settings → Network → Firewall → Options → Confirm Apache is listed and allowed.
    • Linux: Run sudo ufw allow 80/tcp then sudo ufw reload to open port 80.
  • Also, check if another program is using port 80 (e.g., Skype, another web server). Use netstat -ano | findstr :80 (Windows) or lsof -i :80 (macOS/Linux) to identify conflicts. If found, stop the conflicting program or change Apache's port in httpd.conf (e.g., Listen 8080) and update your URL to http://192.168.x.x:8080/mysite.
3. Test the Site Locally First

Before trying on Android, confirm you can access http://192.168.x.x/mysite from your computer's browser (not just http://localhost/mysite):

  • If this fails, the issue is with your server setup, not the Android device.
  • If localhost/mysite works but the local IP URL doesn't, it's almost certainly a network/firewall or Apache listening issue.
4. Android Device Network & Browser Checks

Make sure your Android device isn't the bottleneck:

  • Ensure it's connected to the same Wi-Fi network as your XAMPP computer—mobile data won't work for local server access.
  • Clear your Android browser's cache/cookies, or try a different browser (Chrome, Firefox) to rule out browser-specific glitches.
  • Temporarily disable any ad blockers or VPNs on Android—these can sometimes block connections to local servers.
5. Check for .htaccess Issues

If mysite has a .htaccess file in its root directory, it might contain rules that block external access or rewrite URLs incorrectly. Temporarily rename it to .htaccess.bak and try accessing the site again. If it works, you'll need to adjust the .htaccess rules to allow connections from your local network.

If you've tried all these steps and still run into issues, share details like your OS, XAMPP version, and whether you're using virtual hosts, and we can dig deeper.

内容的提问来源于stack exchange,提问作者Nahla Saad Aldeen

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.19 07:35:45