Nginx access slow problem solving (slow 1s)

Problem scenario:

Today we are doing environment migration on our project.

Phenomenon 1: After the migration, it is suddenly found that the page access speed has slowed down;

Phenomenon 2: The average access to each request is 1 second slower;

Phenomenon 3: But the response speed of accessing the front-end static page is normal.


Bug fixes:

After investigation, it was found that it was a problem with the HTTP version. The default HTTP version of Nginx is 1.0, and the HTTP version needs to be manually configured as 1.1.

proxy_http_version 1.1;

Configure in the server:

server {
    
    
    listen 80;
    server_name localhost;
    proxy_http_version 1.1;
    
    ......
}

Configuration in location:

location /demoApi/ {
    
    
    proxy_http_version 1.1;
    
    include    proxy_param;
    proxy_pass http://192.168.1.2:1001/;
    access_log /home/work/data/httplogs/demoApi-access.log main;
    error_log  /home/work/data/httplogs/demoApi-error.log;
}

After performing the above configuration, reload the Nginx configuration file, and you will find that the access speed is normal.

Tidying up, finishing flowering~

Guess you like

Origin blog.csdn.net/qq_33204709/article/details/128910470