On the forwarding of nginx

worker_processes  1;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    proxy_ignore_client_abort   on;
 
    sendfile        on;
    keepalive_timeout  65;

    server {
        listen 80;
        server_name moye.test.com;
        location / {
            if ($host = "moye.test.com" ) {
               proxy_pass http://localhost:8999;
            }
        }
    }
    server {
        listen 8999;
        server_name zhuanfa;
        location / {
            proxy_pass https://gank.io/api/xiandu/categories;
        }
    }
}

I believe everyone knows the function of this configuration at a glance. After nginx starts with this configuration, it will take a long time for loading, to refresh the browser. How to solve this problem? there is a phenomenon that I think may be the reason for the failure. 80 and 8999 are two requests received by nginx itself. What may have been done inside nginx? search the proxy_ignore_client_abort on; on the Internet. Configuration doesn"t seem to work


if it is

server {
        listen 80;
        server_name moye.test.com;
        location / {
            if ($host = 'moye.test.com' ) {
                proxy_pass https://gank.io;
            }
        }
    }

you can make any request like this, as long as you don't forward it twice

.

try to add the following configurations in the http configuration block

resolver              114.114.114.114; -sharp DNS
proxy_http_version    1.1;
Menu