好的,我有 5 页:

  • 登录.html
  • otp.html
  • 计费.html
  • index.html(用于调试目的)
  • 页面未找到.html

预期逻辑

  • 进入浏览器:

sub.domain.com/path(例如 sub.domain.com/login)

  • 配餐:

(例如


这一切都正常,但现在出于某种原因却让我困惑了——所有东西都返回了 ERR_NAME_NOT_RESOLVED——这是我测试的任何组合,即。/login /login.html /

我已经三次检查了域名(sub.domain.com)的 DNS 记录是否都指向网络服务器 IP。

注意:导航到服务器 IP 地址会加载页面!?DNS 问题?我刚刚运行了 ipconfig /flushdns – 同样的事情。刷新浏览器缓存 – 同样的事情

域名的 DNS 记录如下所示(如果相关):

NGINX(/etc/nginx/sites-enabled/website.conf)文件

server {
server_name sub.domain.com;
root /var/www/html/sub-domain;
index login.html;      # added just to see if it would load - it didn't 
                       # was previously /login.html
                       # changed for testing
location / {
    try_files $uri $uri.html page-not-found; #was previously /page-not-found - changed for testing
}

location /page-not-found {
    try_files $uri.html =404;
}

error_page 404 /custom_404.html;
location = /custom_404.html {
    root /usr/share/nginx.html;
    internal;
    }

listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/sub.domain.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/sub.domain.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}

server {
   if ($host = sub.domain.com) {
       return 301 https://$host$request_uri;
} # managed by Certbot


listen 80;
listen [::]:80;
server_name sub.domain.com;
return 404; # managed by Certbot
}

10

  • 1
    ERR_NAME_NOT_RESOLVED 表示 DNS 问题,与 nginx 无关。


    – 

  • 谢谢 – 好吧,我的错误,我承认错误。有什么提示可以告诉我如何调试此 DNS 问题吗?或者什么可能导致此类故障?


    – 

  • 1
    DNS 不知为何配置不正确。您可能没有告诉我们域名,所以我们无法检查。


    – 

  • @vidarlo 如果可能的话,我希望将其保密 – 但是我已经提供了域名主机上的 DNS 表的布局。


    – 

  • 您是否建议我特别研究一下 DNS 相关的问题?


    – 

0