NGINX 中已删除的域名正在重定向到服务器内的另一个站点

NGINX 中已删除的域名正在重定向到服务器内的另一个站点

我被要求将网站从一个数字海洋服务器更改为另一个,因此我从旧数字海洋服务器中的 nginx 服务器中删除了所有配置,但域名仍在工作,我不知道为什么,我已经删除了 certbot 证书,为什么会发生这种情况?域名正在重定向到以前在同一个 nginf 配置文件中允许的另一个网站。

注释行属于旧域。

server  {
    server_name chilecoaseguro.com www.chilecoaseguro.com;
    access_log /var/log/nginx/chilecoaseguro.com.access.log;
    location / {
        proxy_set_header        Host $host;
        proxy_set_header        X-Real-IP $remote_addr;
            proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header        X-Forwarded-Proto $scheme;
            # Fix the “It appears that your reverse proxy set up is broken" error.
            proxy_pass          http://127.0.0.1:8000;
            proxy_read_timeout      120;
            proxy_redirect          http://127.0.0.1:8000 http://chilecoaseguro.com;
    }


    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/chilecoaseguro.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/chilecoaseguro.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  {
        server_name dev.chilecoaseguro.com;
        access_log /var/log/nginx/dev.chilecoaseguro.com.access.log;
        location / {
                proxy_set_header        Host $host;
                proxy_set_header        X-Real-IP $remote_addr;
                proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header        X-Forwarded-Proto $scheme;
                # Fix the “It appears that your reverse proxy set up is broken" error.
                proxy_pass              http://127.0.0.1:8001;
                proxy_read_timeout      180;
                proxy_redirect          http://127.0.0.1:8001 http://dev.chilecoaseguro.com;
        }


    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/dev.chilecoaseguro.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/dev.chilecoaseguro.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 {
#   server_name inspecciones.naingenieria.cl;
#   access_log /var/log/nginx/inspecciones.naingenieria.cl.access.log;
#   client_max_body_size    150M;
#   location / {
#       proxy_set_header        Host $host;
 #               proxy_set_header        X-Real-IP $remote_addr;
  #              proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
   #             proxy_set_header        X-Forwarded-Proto $scheme;
                # Fix the “It appears that your reverse proxy set up is broken" error.
    #            proxy_pass              http://0.0.0.0:9000;
     #           proxy_redirect          http://0.0.0.0:90000 http://inspecciones.naingenieria.cl;

#       proxy_connect_timeout   500s;
#               proxy_send_timeout      500s;
#               proxy_read_timeout      500s;
#               send_timeout            500s;
#       client_body_timeout     500s;
#   }

#   location /media {
#       autoindex off;
#       alias /root/Projects/projects/mapfre-inspecciones/mapfre-inspecciones/media/;
#       access_log off;
#   }


 #   listen 443 ssl; # managed by Certbot
  #  ssl_certificate /etc/letsencrypt/live/inspecciones.naingenieria.cl/fullchain.pem; # managed by Certbot
   # ssl_certificate_key /etc/letsencrypt/live/inspecciones.naingenieria.cl/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 = www.chilecoaseguro.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


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


    server_name chilecoaseguro.com www.chilecoaseguro.com;
    listen 80;
    return 404; # managed by Certbot




}


#server {
#    if ($host = inspecciones.naingenieria.cl) {
#        return 301 https://$host$request_uri;
#    } # managed by Certbot


#   server_name inspecciones.naingenieria.cl;
#    listen 80;
#    return 404; # managed by Certbot


#}
 

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


        server_name dev.chilecoaseguro.com;
    listen 80;
    return 404; # managed by Certbot


}

答案1

听起来像是 DNS 问题。您是否还更改了该域的 DNS 设置中的 A 记录以指向新服务器的 IP。如果已更改,则更改可能尚未传播。

编辑:更改 DNS 记录的位置取决于域名的名称服务器的位置(通常是域名注册的位置)。很有可能它也在 digital ocean 上。您可以通过登录 digitalocean 并检查网络 标签: 就像这张照片里的那样 然后检查该域的 A 记录

digEDIT2:您还可以使用终端命令检查当前设置,如下所示:

$ dig mydomain.com A

相关内容