The access speed of nginx domain name is very slow and optimized.

ip direct access with port is normal, the speed is OK, the access speed of domain name is very slow, sometimes it can"t be opened, how to optimize it

    server 
    { 
        listen 80;
        server_name www.xxx.com;
        rewrite ^(.*) https://www.xxx.com permanent;
    }


    server {
        listen       443 ssl http2 default_server;
        listen       [::]:443 ssl http2 default_server;
        server_name  www.xxx.com;
        root         /usr/share/nginx/html;

        ssl_certificate /usr/local/nginx/conf/vhost/cert/www.xxx.com.cer;
        ssl_certificate_key /usr/local/nginx/conf/vhost/cert/www.xxx.com.key;
        ssl_session_cache shared:SSL:1m;
        ssl_session_timeout  10m;
        ssl_ciphers HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers on;

        -sharp Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location / {
            proxy_pass http://127.0.0.1:8001;
        }

        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }
Mar.14,2021

that's your domain name resolution problem, not nginx. If the NS of your domain name is abroad, the resolution speed may be slow, and the slow dns server used by the client will also affect the resolution speed.

Menu