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

httpd部署问题:本地可访问网页但其他电脑无法访问

Troubleshooting Remote Access to Your Apache Server

Hey there! Let's break down why other machines can't reach your Apache setup, even though you can access it locally. Here are the key checks to run through:

1. Confirm the IP Address You're Using

First off, 172.31.30.53 looks like a private internal IP address (common in AWS EC2 or local network setups).

  • If the remote computers are not on the same local network/VPC, you'll need to use your server's public IP instead. Run curl ifconfig.me on your server to grab its public IP, then test that address from the remote machine.
  • If they are on the same network, start with basic connectivity: run ping 172.31.30.53 from the remote computer. If ping fails, there's a network routing issue to fix before diving into Apache settings.

2. Check if Port 80 is Reachable Externally

Your local nmap scan shows port 80 is open, but we need to confirm it's accessible from outside the server:

  • On the remote machine, run this command:
    nmap 172.31.30.53 -p 80
    
    If the result says filtered or closed, traffic to port 80 is being blocked somewhere.

3. Double-Check Firewall Rules (Beyond UFW)

Even though UFW allows port 80, there might be other firewalls in play:

  • If you're using a cloud server (like AWS EC2): Verify your security group allows inbound traffic on port 80 from the remote machine's IP (or 0.0.0.0/0 for temporary testing).
  • If you're on RHEL/CentOS (since you're using httpd instead of apache2): Check if firewalld is running and permitting HTTP traffic:
    sudo firewall-cmd --list-all
    
    If http isn't listed in the services section, add it with:
    sudo firewall-cmd --add-service=http --permanent
    sudo firewall-cmd --reload
    

4. Update Apache Configuration for Modern Versions

Your <Directory> block uses Apache 2.2-style authorization rules (Order allow,deny / allow from all). If you're running Apache 2.4 (standard on most modern systems), switch to the newer syntax to avoid compatibility issues:
Edit your /etc/httpd/conf/httpd.conf file and update the directory block:

<Directory /var/www/html>
    AllowOverride None
    # Replace old authorization rules with this line
    Require all granted
</Directory>

Then restart Apache to apply changes:

sudo apachectl restart

5. Verify Apache is Listening on All Interfaces

Your config has Listen 0.0.0.0:80 (which tells Apache to listen on all network interfaces), but let's confirm this is working:

sudo netstat -tulpn | grep httpd

You should see a line like tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN [PID]/httpd — this confirms Apache isn't restricted to localhost only.

Start with these checks, and share what you find so we can narrow it down further!

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.28 07:05:17