nginx using static directory giant slow

To reduce overhead, the webapp deployed separately to the linux folder, and back-end is separated, then use the static nginx directory function.

 

location /webapp/myapp/ {
    root  /usr/share/nginx/html/;
}

  

However, geese, test access, obviously felt slower than on the back-end code escrow.

 

 optimization

 

    gzip  on;
    gzip_min_length   1k;
    gzip_buffers  4 8k;
    gzip_http_version 1.1;
    gzip_comp_level 2;
    gzip_vary off;
    gzip_types  text/plain application/x-javascript text/css application/javascript application/json application/xml image/jpeg image/gif image/png;
    gzip_disable "MSIE [1-6]\.";

    open_file_cache max=1000 inactive=300s;
    open_file_cache_valid 360s;
    open_file_cache_min_uses 2;
    open_file_cache_errors off;


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

    location /webapp/myapp/ {
        root  /usr/share/nginx/html/;
        expires 30d;  
    }
}

  

1.gzip compression 

2. File Cache

Guess you like

Origin www.cnblogs.com/saving/p/11563546.html