AWS注册域名绑定EC2弹性IP后无法访问,请求技术协助
Let’s troubleshoot this issue step by step—this is a super common gotcha when setting up domains with AWS, so I’ve got a few things you can check right away:
Before diving into AWS settings, let’s verify if your domain is even pointing to the right IP. Open a terminal or command prompt and run one of these commands (replace yourdomain.com with your actual domain):
- On macOS/Linux:
dig yourdomain.com - On Windows:
nslookup yourdomain.com
Look for the "ANSWER SECTION" in the output. If you don’t see your Elastic IP listed here, the problem is definitely with your Route 53 or domain registrar setup. If you do see the correct IP, skip ahead to checking your EC2 instance.
This is the #1 mistake people make when setting up Route 53:
- Go to your Route 53 hosted zone for the domain. Look at the NS records (the ones starting with
ns-xxxx.awsdns-xx.orgetc.). There should be 4 of them. - Now go to your AWS Domain Registrar (or whichever service you used to register the domain) and check the "Name Servers" settings for your domain. They must exactly match the 4 NS records from Route 53. If they don’t, update them—this tells the internet to use Route 53 to resolve your domain’s DNS.
Double-check the A record you created:
- Make sure the record type is set to A - IPv4 address.
- Confirm the "Value" field is your Elastic IP (no extra spaces, just the IP itself).
- Ensure the record is set to ENABLED (you’ll see a checkmark in the status column).
- Also, check if you accidentally created multiple hosted zones for the same domain—sometimes AWS creates a new one if you click the wrong button, and you might be editing the wrong zone.
If DNS is resolving correctly but the site still won’t load:
- First, try accessing your WordPress site directly using the Elastic IP (e.g.,
http://1.2.3.4). If this doesn’t work, the issue is with your EC2 instance, not DNS:- Check if your web server (Apache/Nginx) is running: Run
systemctl status apache2orsystemctl status nginxon your EC2 instance via SSH. - Make sure your EC2 security group allows inbound traffic on port 80 (HTTP) and/or 443 (HTTPS). The source should be
0.0.0.0/0(for public access) or your specific IP if you’re testing.
- Check if your web server (Apache/Nginx) is running: Run
- Confirm your Elastic IP is actually attached to the correct EC2 instance (go to EC2 > Elastic IPs > check the "Instance" column).
Sometimes your local machine is still using old DNS data. Clear the cache with these commands:
- Windows:
ipconfig /flushdns - macOS:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder - Linux:
sudo systemctl restart systemd-resolved(orsudo /etc/init.d/dns-clean startdepending on your distro)
DNS changes can take time to propagate across the internet—even with a TTL of 300 seconds (5 minutes), some DNS servers might cache the old records for longer. Give it 10-15 minutes, or up to 24 hours in rare cases, before ruling out propagation delays.
Start with checking the NS record match between your registrar and Route 53—9 times out of 10, that’s the fix. Let me know which step resolves it!
内容的提问来源于stack exchange,提问作者Debarghya Chanda

