server { listen 80; server_name localhost; client_max_body_size 100m; client_body_buffer_size 128k; proxy_connect_timeout 5; proxy_send_timeout 1800; proxy_read_timeout 1800; proxy_buffer_size 4k; proxy_buffers 4 32k; proxy_busy_buffers_size 64k; proxy_temp_file_write_size 64k; auth_basic "status"; #开启gzip gzip on; #低于1kb的资源不压缩 gzip_min_length 1k; #压缩级别1-9,越大压缩率越高,同时消耗cpu资源也越多,建议设置在5左右。 gzip_comp_level 5; #需要压缩哪些响应类型的资源,多个空格隔开。不建议压缩图片. gzip_types text/plain application/javascript application/x-javascript text/javascript text/xml text/css; #配置禁用gzip条件,支持正则。此处表示ie6及以下不启用gzip(因为ie低版本不支持) gzip_disable "MSIE [1-6]\."; #是否添加“Vary: Accept-Encoding”响应头 gzip_vary on; location / { root /usr/share/nginx/html; index index.html index.htm; try_files $uri $uri/ /index.html; #VUE项目,配置路由(必须) } location ^~ /assessh5 { alias /usr/share/nginx/html; # inflow uni-app H5编译文件的目录,index.html所在目录 try_files $uri $uri/ /index.html last; index index.html index.htm; } # location /inflow { # try_files $uri $uri/ /inflow/index.html; # root /usr/share/nginx/html/inflow/; # index index.html; # } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } }