NGINX 无法解析域名

NGINX 无法解析域名

今天早上我发现一个问题,我可以通过 IP 通过 SFTP SSH 等访问服务器,但如果我尝试通过域访问,我会收到以下错误:

找不到 dev.tinyturtles.co.nz 的服务器 IP 地址。

NGINX Config 已完成,并且 NGINX 已启动

UFW 状态:

To                         Action      From
--                         ------      ----
22                         ALLOW       Anywhere                  
80                         ALLOW       Anywhere                  
443                        ALLOW       Anywhere                  
20/tcp                     ALLOW       Anywhere                  
21/tcp                     ALLOW       Anywhere                  
990/tcp                    ALLOW       Anywhere                  
40000:50000/tcp            ALLOW       Anywhere                  
22 (v6)                    ALLOW       Anywhere (v6)             
80 (v6)                    ALLOW       Anywhere (v6)             
443 (v6)                   ALLOW       Anywhere (v6)             
20/tcp (v6)                ALLOW       Anywhere (v6)             
21/tcp (v6)                ALLOW       Anywhere (v6)             
990/tcp (v6)               ALLOW       Anywhere (v6)             
40000:50000/tcp (v6)       ALLOW       Anywhere (v6)             

NGINX 配置:

user www-data;
worker_processes 1;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
    worker_connections 1024;
    multi_accept on;
}

http {

    ##
    # Basic Settings
    ##

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 15;
    types_hash_max_size 2048;
    server_tokens off;
    client_max_body_size 64m;

    # server_names_hash_bucket_size 64;
    # server_name_in_redirect off;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;


    ##
    # SSL Settings
    ##

    add_header Strict-Transport-Security "max-age=31536000; includeSubdomains";
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 10m;


    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;

    ##
    # Logging Settings
    ##

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

    ##
    # Gzip Settings
    ##

    gzip on;
    gzip_disable "msie6";

    # gzip_vary on;
      gzip_proxied any;
      gzip_comp_level 2;
    # gzip_buffers 16 8k;
    # gzip_http_version 1.1;
      gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;


    ##
    # Cache Settings
    ##

    fastcgi_cache_key "$scheme$request_method$host$request_uri";
    add_header Fastcgi-Cache $upstream_cache_status;

    ##
    # Virtual Host Configs
    ##

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;

server {
    listen 80 default_server;
    listen [::]:80 default_server;
    server_name _;
    return 444;
}
}


#mail {
#   # See sample authentication script at:
#   # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
# 
#   # auth_http localhost/auth.php;
#   # pop3_capabilities "TOP" "USER";
#   # imap_capabilities "IMAP4rev1" "UIDPLUS";
# 
#   server {
#       listen     localhost:110;
#       protocol   pop3;
#       proxy      on;
#   }
# 
#   server {
#       listen     localhost:143;
#       protocol   imap;
#       proxy      on;
#   }
#}

站点配置:

fastcgi_cache_path /home/jess/dev.tinyturtles.co.nz/cache levels=1:2 keys_zone=dev.domain.co.nz:100m inactive=60m;

server {
    listen 80;
    listen [::]:80;

    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    ssl_certificate  /etc/letsencrypt/live/dev.domain.co.nz/fullchain.pem;
    ssl_certificate_key  /etc/letsencrypt/live/dev.domain.co.nz/privkey.pem;

    server_name dev.tinyturtles.co.nz;

     if ($http_x_forwarded_proto = "http") {
      return 301 https://$server_name$request_uri;
  }



    access_log /home/jess/dev.tinyturtles.co.nz/logs/access.log;
    error_log /home/jess/dev.tinyturtles.co.nz/logs/error.log;

    root /home/jess/dev.tinyturtles.co.nz/public/;
    index index.php;


    set $skip_cache 0;

    # POST requests and urls with a query string should always go to PHP
    if ($request_method = POST) {
        set $skip_cache 1;
    }   
    if ($query_string != "") {
        set $skip_cache 1;
    }   

    # Don’t cache uris containing the following segments
    if ($request_uri ~* "/wp-admin/|/xmlrpc.php|wp-.*.php|/feed/|index.php|sitemap(_index)?.xml") {
        set $skip_cache 1;
    }   

    # Don’t use the cache for logged in users or recent commenters
    if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") {
        set $skip_cache 1;
    }

    location / {
        try_files $uri $uri/ /index.php?$args; 
    }

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/run/php/php7.1-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;

        fastcgi_cache_bypass $skip_cache;
        fastcgi_no_cache $skip_cache;
        fastcgi_cache dev.domain.co.nz;
        fastcgi_cache_valid 60m;
    }
}

答案1

你的域名已过期大约12小时前。

query_status: 210 PendingRelease
domain_dateregistered: 2010-01-25T21:47:09+13:00
domain_datebilleduntil: 2018-02-25T21:47:09+13:00
domain_datelastmodified: 2018-02-25T23:31:23+13:00
domain_datecancelled: 2018-02-25T23:31:23+13:00

接触您的注册商有关恢复和续订域名的进一步说明。

相关内容