主域一直转到子域

Main domain keeps going to a subdomain

我在 abc.com 有一个 Wordpress 站点,在 app.xyz.com 有一个 Rails 应用程序,同一台服务器。注意不同的域。但是当我输入abc.com时,它显示app.xyz.com中的内容,而在地址栏中显示abc.com。我做错了什么?

abc.com

的 nginx 配置文件
server {
        listen 80;
        root /var/www/abc;
        index index.php index.html index.htm index.nginx-debian.html;
        server_name abc.com;
        client_max_body_size 20M;

        location / {
                #try_files $uri $uri/ =404;
                try_files $uri $uri/ /index.php$is_args$args;
        }

        location ~ \.php$ {
                include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
        }

        location ~ /\.ht {
                deny all;
        }

        location = /favicon.ico { log_not_found off; access_log off; }

        location = /robots.txt { log_not_found off; access_log off; allow all; }

        location ~ ^/\.user\.ini {
                deny all;
        }

        location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
                expires max;
                log_not_found off;
        }
}

app.xyz.com

的 nginx 配置文件
upstream xyz {
  server unix:/home/deployer/app/shared/tmp/sockets/puma.sock fail_timeout=0;
}

server {
  listen 80;
  server_name app.xyz.com;

  client_max_body_size 4G;
  keepalive_timeout 10;

  error_page 500 502 503 504 /500;

  root /home/deployer/app/current/public;

  try_files $uri/index.html $uri.html $uri @app;

  location @app {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;

    proxy_pass http://xyz;
  }

  location = /50x.html {
    root html;
  }

  location = /404.html {
    root html;
  }

  location @503 {
    error_page 405 = /system/maintenance.html;
    if (-f $document_root/system/maintenance.html) {
      rewrite ^(.*)$ /system/maintenance.html break;
    }
    rewrite ^(.*)$ /503.html break;
  }

  if ($request_method !~ ^(GET|HEAD|PUT|PATCH|POST|DELETE|OPTIONS)$ ){
    return 405;
  }

  if (-f $document_root/system/maintenance.html) {
    return 503;
  }
}

在 abc.com 的 nginx 配置文件中,在顶部添加:

server {
  server_name abc.com;
  return 301 $scheme://www.abc.com$request_uri;
}