Nginx配置GZIP

記錄一次解決網站加載慢的問題javascript


一. nginx配置php

gzip on;
gzip_min_length  1k;
gzip_buffers     4 16k;
gzip_http_version 1.1;
gzip_comp_level 4;
gzip_types       text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
gzip_vary on;css

參數

2、操做步驟java

1. 編輯nginx配置nginx

vim /usr/local/nginx/conf/nginx.confvim

2. 重啓nginx(重啓時使用的是第一次啓動時的配置文件,若無效,應該關閉nginx,並從新開啓)app

/usr/local/nginx/sbin/nginx -s reload       #修改配置後從新加載生效測試


nginx -t -c /path/to/nginx.conf  #測試nginx配置文件是否正確網站

ps -ef | grep nginx3d

kill -QUIT 主進程號     #從容中止Nginx
kill -TERM 主進程號     #快速中止Nginx
pkill -9 nginx          #強制中止Nginx

nginx -c /path/to/nginx.conf #重啓nginx

相關文章
相關標籤/搜索