简体   繁体   English

将子域重定向到 nginx web 服务器时出现问题

[英]Problem redirecting subdomain to nginx web server

Problem explanation问题说明

I want to show one service in my domain and another different service in my subdomain, so I purchased a domain and tried to link it to my Nginx web server.我想在我的域中显示一个服务,在我的子域中显示另一个不同的服务,所以我购买了一个域并尝试将它链接到我的 Nginx web 服务器。

I have buyed the domain in google domains.我已经在 google 域中购买了该域。 And uploaded my web application to a Nginx web server.并将我的 web 应用程序上传到 Nginx web 服务器。

When I run my domain for example www.balls.com it's redirected perfectly, but when I try to redirect to my subdomain, there is no way to make it work, I have tried different configurations and received 2 different errors:当我运行我的域时,例如www.balls.com它被完美地重定向,但是当我尝试重定向到我的子域时,没有办法让它工作,我尝试了不同的配置并收到 2 个不同的错误:

-DNS doesn't exist (Checked with DNScheck). -DNS 不存在(通过 DNScheck 检查)。
-Google DNS page error. -Google DNS 页面错误。

google domain service config:谷歌域名服务配置:

Nameservers:域名服务器:

-Using the Google Domains nameservers. - 使用 Google Domains 域名服务器。

DNSSEC DNSSEC

-Your domain has DNSSEC enabled. - 您的域启用了 DNSSEC。

Registered hosts注册主机

red.balls.com-->111.11.11.11 (My server Address). red.balls.com-->111.11.11.11(我的服务器地址)。

Synthetic records合成记录

Domain forward域转发
balls.com, www.balls.com → 111.11.11.11 (My server Address). balls.com, www.balls.com → 111.11.11.11(我的服务器地址)。

Custom resource records (Extracted from exported records)自定义资源记录(从导出的记录中提取)

balls.com.balls.com.球.com.球.com。 3600 IN A 111.11.11.11 3600 IN A 111.11.11.11
red.balls.com.balls.com. red.balls.com.balls.com。 3600 IN A 111.11.11.11 3600 IN A 111.11.11.11
www.balls.com . www.balls.com 3600 IN A 111.11.11.11 3600 IN A 111.11.11.11
www.balls.com.balls.com . www.balls.com.balls.com 3600 IN A 111.11.11.11 3600 IN A 111.11.11.11

nginx services config: nginx 服务配置:

Subdomain service:子域服务:

server {
        listen   80;

        root /var/www/redballs.com;

        index index.html index.htm;

        server_name red.balls.com;
}

Subdomain service:子域服务:

server {

    listen   80;

    root /var/www/balls.com;

    index index.html index.htm;

    server_name balls.com;
}

Thanks for your read time, a simple comment pointing what I'm doing wrong will be very appreciated, as I have finished my application but I'm unable to set up this subdomain.感谢您的阅读时间,非常感谢您指出我做错了什么的简单评论,因为我已经完成了我的申请,但我无法设置这个子域。 Thanks again.再次感谢。

that sounds a lot like a DNS problem to me.对我来说,这听起来很像 DNS 问题。 Did you add a DNS record for the subdomain?您是否为子域添加了 DNS 记录?

Each hostname you want to use needs a mapping in DNS to the IP addresses of the host or a CNAME pointing to another name.您要使用的每个主机名都需要在 DNS 中映射到主机的 IP 地址或指向另一个名称的 CNAME。

It is a bit hard to debug a DNS Problem without seeing thr actual data.在没有看到实际数据的情况下调试 DNS 问题有点困难。

Sidenote: www.balls.com.balls.com .旁注: www.balls.com.balls.com looks to me like you forgot a dot when creating that entry.在我看来,您在创建该条目时忘记了一个点。 In DNS a name always ends with a dot in the configuration (or zone file) if you omit it, the domain name is usually automatically appended.在 DNS 中,如果您省略名称,则配置(或区域文件)中的名称始终以点结尾,通常会自动附加域名。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM