Nginx 使用子域名提供错误的网站

Nginx 使用子域名提供错误的网站

这些都是新手,所以请耐心等待。我有一个使用 nginx 设置的现有网站(fusiondiscordbots.com),但是我想在子域上添加第二个网站 - dash.application-bot.com。主域设置为 GitHub.io 站点,同时子域的 A 记录指向我的 nginx 托管 VPS 的 IP。当我尝试连接到子域时,我得到的是另一个站点(fusiondiscordbots.com)。我想知道是否有人可以帮忙,我已经复制了以下所有配置文件。谢谢,肖恩。

Nginx 配置

server {
        server_name www.dashboard.application-bot.com;
        return 301 https://dashboard.application-bot.com$request_uri;
}

server {
        listen 80;

        server_name dashboard.application-bot.com;
        location / {
                return 301 https://dashboard.application-bot.com$request_uri;
        }
}

server {
        listen 443 ssl;
        server_name dashboard.application-bot.com;

        ssl_certificate /etc/letsencrypt/live/dashboard.application-bot.com/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/dashboard.application-bot.com/privkey.pem;

        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;

        location / {
                proxy_pass https://localhost:8004;
                proxy_redirect off;
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }

        location /static {
                alias /var/www/application-web/app/static;
                expires 30d;
        }

}

fusiondiscordbots.com 的其他 nginx 配置文件

server {
        server_name www.fusiondiscordbots.com;
        return 301 https://fusiondiscordbots.com$request_uri;
}

server {
        listen 80;

        server_name fusiondiscordbots.com;
        location / {
                return 301 https://$host$request_uri;
        }
}

server {
        listen 443 ssl;
        server_name fusiondiscordbots.com;

        ssl_certificate /etc/letsencrypt/live/fusiondiscordbots.com/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/fusiondiscordbots.com/privkey.pem;

        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;

        location / {
                proxy_pass https://localhost:8001;
                proxy_redirect off;
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }

        location /static {
                alias /var/www/fusion-web/app/static;
                expires 30d;
        }

        location /sitemap.xml {
                alias /var/www/fusion-web/app/static/sitemap.xml;
                expires 30d;
        }

        location /robot.txt {
                alias /var/www/fusion-web/app/static/robot.txt;
                expires 30d;
        }

        location /.well-known {
                alias /var/www/fusion-web/app/static/;
                expires 30d;
        }
}

任何想法都会受到赞赏,如果需要更多信息,请询问。再次感谢。

相关内容