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

将子域名重定向至其他主机/服务器遇503错误求助

Troubleshooting 503 Error for Subdomain Redirect to Another Server

Let’s break down the possible issues step by step—since your setup worked briefly, the problem is likely something that changed on the second server or in its configuration, rather than a fundamental DNS issue.

1. Check if the Second Server’s Web Service is Running

First, make sure your web server (Nginx, Apache, etc.) on the second host is actually up and running. SSH into the second server and run:

# For Nginx
sudo systemctl status nginx
# For Apache
sudo systemctl status apache2

If it shows "inactive" or "failed", restart it immediately:

sudo systemctl restart nginx
# Or for Apache
sudo systemctl restart apache2

Then check the error logs to see why it might have crashed or stopped:

# Nginx default error log
sudo tail -f /var/log/nginx/error.log
# Apache default error log
sudo tail -f /var/log/apache2/error.log

Look for lines about missing files, permission errors, or configuration mistakes—those are common culprits.

2. Verify the Subdomain’s Virtual Host Configuration

Double-check that the virtual host (vhost) for your subdomain on the second server is set up correctly.

For Nginx, your config should look something like this (usually in /etc/nginx/sites-available/):

server {
    listen 80;
    server_name your-subdomain.your-domain.com;
    root /path/to/your/website/files;
    index index.html index.php;

    # Rest of your config...
}

For Apache, the vhost (in /etc/apache2/sites-available/) should include:

<VirtualHost *:80>
    ServerName your-subdomain.your-domain.com
    DocumentRoot /path/to/your/website/files
    # Rest of your config...
</VirtualHost>

After verifying, test for syntax errors:

# Nginx
sudo nginx -t
# Apache
sudo apache2ctl configtest

If there’s an error, fix it then reload the web server. Also, make sure the web root directory exists and has the right permissions for the web server user (usually www-data):

sudo chown -R www-data:www-data /path/to/your/website/files
sudo chmod -R 755 /path/to/your/website/files

3. Rule Out Network/Firewall Issues

Even if DNS is resolved, the second server might be blocking traffic on ports 80/443.

First, confirm your subdomain is pointing to the correct IP:

nslookup your-subdomain.your-domain.com
# Or use dig for more details
dig your-subdomain.your-domain.com

Then check the second server’s firewall status. If using UFW:

sudo ufw status

If 80/tcp or 443/tcp aren’t listed as allowed, add them:

sudo ufw allow 80/tcp
sudo ufw allow 443/tcp

You can also test if the port is reachable directly from your local machine:

curl -I http://[second-server-ip]

If this also returns a 503, the problem is definitely on the second server itself, not DNS or routing.

4. Check for Resource Limits on the Second Server

A sudden 503 could mean the second server ran out of resources (CPU, memory, disk space). Run these commands to check:

# Check CPU/memory usage
htop
# Or use top if htop isn't installed
top
# Check disk space
df -h

If memory is maxed out, kill any unnecessary processes or consider upgrading the server. If disk is full, delete old logs or unused files to free up space.

5. Make Sure No Residual Configs Are On the First Server

Double-check that you didn’t leave any leftover configurations on the first server for this subdomain—like a reverse proxy or redirect rule that might be conflicting. If you had any temporary setup there, fully remove it to ensure all traffic goes straight to the second server’s IP via the A record.

6. Check Your Host Provider’s Status

Sometimes 503 errors are out of your control—your host might be doing maintenance, or your second server might have been temporarily throttled or suspended. Log into your second host’s control panel and look for any alerts or notifications about the server’s status.

Start with the first two steps since those are the most likely causes given your setup worked initially. Let me know if you find any specific errors in the logs or configs!

内容的提问来源于stack exchange,提问作者Walter Victor

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.28 06:32:18