EC2实例公网IP无法从RDP外部访问的问题排查求助
Hey there, nice job narrowing down that XAMPP works externally on port 80 but IIS doesn't—that already helps rule out some obvious issues! Let's walk through the most likely culprits here:
Check IIS Site Bindings
Make sure your IIS site isn't only bound tolocalhostor your EC2 instance's private IP. Open IIS Manager, right-click your app's site, select Edit Bindings, and verify the HTTP binding's IP address is set to*(All Unassigned) or your public IP. If it's locked to a private IP, external requests won't reach it.Verify Windows Firewall Rules
XAMPP often auto-creates firewall rules to allow port 80 traffic, but IIS might not have that setup. Head to Windows Defender Firewall > Advanced Settings > Inbound Rules and check if there's a rule allowing TCP port 80 for all network profiles (Domain, Private, Public). If not, create a new inbound rule: allow TCP 80, apply to all remote IPs, and enable it.Double-Check EC2 Security Group Settings
Even though XAMPP works, it's worth confirming your EC2 security group's inbound rules. Ensure there's a rule for HTTP (port 80) with a source of0.0.0.0/0(or your specific external IP range if you want to restrict it). Sometimes rules can get accidentally modified, so a quick check never hurts.Confirm IIS is Listening on the Right Interface
Open Command Prompt and runnetstat -ano | findstr ":80"while IIS is running. You should see entries listening on0.0.0.0:80(all interfaces) instead of just127.0.0.1:80(local only). The process ID (PID) should map tosystem(PID 4) orw3wp.exe(IIS worker process).Test External Connectivity Directly
From a device outside your RDP session, try runningtelnet your-public-ip 80orcurl your-public-ipto see what happens. If it times out, it's likely a firewall/security group issue. If it connects but returns no content, the problem is probably in IIS's site configuration.
备注:内容来源于stack exchange,提问作者Mega

