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

Route53指向Classic ELB后出现503服务不可用问题求助

Troubleshooting Route53 CNAME to Classic ELB 503 Error

Hey there, let's break down why your Route53 CNAME is throwing a 503 error even though your ELB works directly. Since your ELB's public URL works and instances show healthy, the issue is almost certainly tied to DNS resolution, ELB configuration, or how Nginx handles requests from your custom domain.

Here are the key steps to diagnose and fix this:

1. Verify DNS Resolution is Correct

First, make sure your custom domain is actually pointing to the right ELB public domain. Use these commands to check:

  • dig your-custom-domain.com CNAME
  • nslookup your-custom-domain.com

Check that the returned target is exactly your ELB's public DNS name (looks like your-elb-1234567890.us-east-1.elb.amazonaws.com—not an internal VPC domain ending in .compute.internal). Also, if you just created the CNAME, wait a few minutes for DNS propagation (Route53 is fast, but some local ISPs might cache old records). You can flush your local DNS cache if needed.

2. Check ELB Listener & SSL Certificate Configuration

Even though the ELB works directly, confirm:

  • Your ELB's HTTPS listener (port 443) is correctly forwarding traffic to your Nginx instance's port 80.
  • The SSL certificate attached to the ELB includes your custom domain as a subject alternative name (SAN). If the certificate only covers the ELB's default domain, some clients might reject the connection—while this usually throws a certificate error, it's still worth ruling out.

3. Inspect Nginx's Server Block Configuration

This is a common gotcha: if your Nginx server block only listens for requests targeting the ELB's domain or your instance's public IP, it might not recognize requests coming in via your custom domain.

Open your Nginx config file (usually in /etc/nginx/sites-available/ or /etc/nginx/nginx.conf) and check the server_name directive. It should include your custom domain, like:

server {
    listen 80;
    server_name your-custom-domain.com www.your-custom-domain.com;
    # rest of your config...
}

If it's missing, add your domain, save the file, and restart Nginx with sudo systemctl restart nginx.

4. Check Nginx & ELB Logs

Dig into logs to see where the request is failing:

  • Nginx Logs: Run tail -f /var/log/nginx/access.log and tail -f /var/log/nginx/error.log while accessing your custom domain. If you don't see the request show up, the problem is before Nginx (ELB or DNS). If you do see it, check the response code to pinpoint Nginx-specific issues.
  • ELB Access Logs: If you have ELB access logs enabled (you can turn this on in the EC2 Console under ELB settings), check if the requests are reaching the ELB and being forwarded to your instance. Look for 503 entries—they'll tell you if the ELB couldn't route the request to a healthy instance (even though health checks pass, there might be a routing edge case).

5. Rule Out Security Group Misconfigurations

Double-check security groups to ensure:

  • Your ELB's security group allows inbound HTTPS (443) traffic from 0.0.0.0/0 (all clients).
  • Your Nginx instance's security group allows inbound HTTP (80) traffic from your ELB's security group (not just public IPs). Even though the ELB works directly, it's possible a misconfigured security group is blocking traffic when the request comes via the custom domain (unlikely, but worth verifying).

Once you've worked through these steps, your custom domain should route correctly through Route53 to your ELB and Nginx instance.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.20 11:32:34