亚洲中字慕日产2020,大陆极品少妇内射AAAAAA,无码av大香线蕉伊人久久,久久精品国产亚洲av麻豆网站

資訊專欄INFORMATION COLUMN

nginx gzip配置參數(shù)解讀

付永剛 / 1587人閱讀

本文主要解析一下nginx ngx_http_gzip_module以及ngx_http_gzip_static_module中的gzip相關配置參數(shù)。

gzip
名稱 默認配置 作用域 官方說明 中文解讀 模塊
gzip gzip off; http, server, location, if in location Enables or disables gzipping of responses. 設置是否開啟對后端響應的gzip壓縮,然后返回壓縮內容給前端 ngx_http_gzip_module
gzip_buffers gzip_buffers 32 4k或16 8k; http, server, location Sets the number and size of buffers used to compress a response. By default, the buffer size is equal to one memory page. This is either 4K or 8K, depending on a platform. 設置用于壓縮后端response的buffer的數(shù)量和每個的大小,默認每個buffer大小為一個內存頁,根據平臺不同可能是4k或8k ngx_http_gzip_module
gzip_comp_level gzip_comp_level 1; http, server, location Sets a gzip compression level of a response. Acceptable values are in the range from 1 to 9. 指定gzip壓縮的級別,默認為1,該值可設置的范圍是1-9,1為最小化壓縮(處理速度快),9為最大化壓縮(處理速度慢),數(shù)字越大壓縮的越好,也越占用CPU時間 ngx_http_gzip_module
gzip_disable 沒有默認值 http, server, location Disables gzipping of responses for requests with User-Agent header fields matching any of the specified regular expressions. 正則匹配User-Agent中的值,匹配上則不進行gzip ngx_http_gzip_module
gzip_min_length gzip_min_length 20; http, server, location Sets the minimum length of a response that will be gzipped. The length is determined only from the Content-Length response header field. 設定進行gzip壓縮的閾值,當后端response的Content-Length大小小于該值則不進行gzip壓縮 ngx_http_gzip_module
gzip_http_version gzip_http_version 1.1; http, server, location Sets the minimum HTTP version of a request required to compress a response. 設定進行gzip壓縮的最小http版本 ngx_http_gzip_module
gzip_proxied gzip_proxied off; http, server, location Enables or disables gzipping of responses for proxied requests depending on the request and response. The fact that the request is proxied is determined by the presence of the "Via" request header field. 根據request或響應的相關header的值來決定是否進行gzip ngx_http_gzip_module
gzip_types gzip_types text/html; http, server, location Enables gzipping of responses for the specified MIME types in addition to "text/html". The special value "*" matches any MIME type (0.8.29). Responses with the "text/html" type are always compressed. 指定哪些mime types啟用gzip壓縮,默認text/html ngx_http_gzip_module
gzip_vary gzip_vary off; http, server, location Enables or disables inserting the "Vary: Accept-Encoding" response header field if the directives gzip, gzip_static, or gunzip are active. 是否往response header里頭寫入Vary: Accept-Encoding ngx_http_gzip_module
gzip_static gzip_static off; http, server, location Enables ("on") or disables ("off") checking the existence of precompressed files. The following directives are also taken into account: gzip_http_version, gzip_proxied, gzip_disable, and gzip_vary. 開啟之后,接到(靜態(tài)文件)請求會到url相同的路徑的文件系統(tǒng)去找擴展名為".gz"的文件,如果存在直接把它發(fā)送出去,如果不存在,則進行gzip壓縮,再發(fā)送出去 ngx_http_gzip_static_module
實例
http {
    gzip on;
    gzip_buffers 8 16k; ## 這個限制了nginx不能壓縮大于128k的文件
    gzip_comp_level 2;
    gzip_disable "MSIE [1-6].(?!.*SV1)";
    gzip_min_length 512; ##單位byte
    gzip_http_version 1.0;
    gzip_proxied expired no-cache no-store private auth;
    gzip_types   text/plain application/x-javascript text/css application/xml;
    gzip_vary on;
    gzip_static  on;
    //......
}
doc

nngx_http_gzip_module

加速nginx: 開啟gzip和緩存

mozilla Vary

HTTP 協(xié)議中 Vary 的一些研究

Nginx中gzip_static模塊的使用

文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。

轉載請注明本文地址:http://www.ezyhdfw.cn/yun/39753.html

相關文章

  • nginx服務器安裝及配置文件詳解

    摘要:部分設置的指令將影響其它所有部分的設置部分的指令主要用于指定虛擬主機域名和端口的指令用于設置一系列的后端服務器,設置反向代理及后端服務器的負載均衡部分用于匹配網頁位置比如,根目錄等等。 nginx在工作中已經有好幾個環(huán)境在使用了,每次都是重新去網上扒博客,各種編譯配置,今天自己也整理一份安裝文檔和nginx.conf配置選項的說明,留作以后參考。像負載均衡配置(包括健康檢查)、緩存(包...

    mylxsw 評論0 收藏0
  • 11 個 Nginx 參數(shù)性能優(yōu)化工作

    摘要:配置如下指令是設定的工作模式及連接數(shù)上限。指令用來指定的工作模式。該參數(shù)默認是,建議開啟。配置進程的最大打開文件數(shù)調整配置進程的最大打開文件數(shù),這個控制連接數(shù)的參數(shù)為。但副作用是資源更新可能無法及時。 工作上,需要配置 Nginx,要投入生產使用,做了一點優(yōu)化工作,加上以前也經常折騰 Nginx,故記下一些優(yōu)化工作。 優(yōu)化 Nginx 進程數(shù)量 配置參數(shù)如下: worker_proce...

    zebrayoung 評論0 收藏0
  • nginx配置中開啟gzip來壓縮網頁文件提高網站速度

    摘要:如何開啟來壓縮網頁文件提高網站速度要知道網站的打開速度取決于瀏覽器打開下載的網頁文件大小。你可以在配置中開啟來壓縮網頁文件。默認情況下,僅壓縮文件。服務器上設置站點上設如何在中開啟壓縮服務讓網頁速度更快服務器設置壓縮是開發(fā)里很普遍的做法。nginx如何開啟gzip來壓縮網頁文件提高網站速度?要知道網站的打開速度取決于瀏覽器打開下載的網頁文件大小。如果傳輸?shù)捻撁鎯热菸募p少,那你網站的打開速度...

    stonezhu 評論0 收藏0
  • 我用到的nginx

    摘要:有每個進程的最大連接數(shù),選取哪種事件驅動模型處理連接請求,是否允許同時接受多個網路連接,開啟多個網絡連接序列化等。 查看nginx配置文件位置 方式11) netstat -anop | grep 0.0.0.0:80 查看nginx的pid2) ll /proc/4562/exe nginx運行的路徑(比如查詢到: /usr/sbin/nginx)3) /usr/sbin/ng...

    zhaofeihao 評論0 收藏0
  • 高并發(fā)場景中nginx的優(yōu)化方案

    摘要:本文主要從以下幾點講解如何優(yōu)化,以增強高并場景中的吞吐量。系統(tǒng)可通過命令查看核數(shù),假如為,則指單個進程能并發(fā)處理的最大連接數(shù),包含了所有的鏈接不僅僅來源于客戶端,默認值是,在一些瞬間并發(fā)量較高的場景中,這個值是遠遠不夠用的。 本文主要從以下幾點講解如何優(yōu)化Nginx,以增強高并場景中Nginx的吞吐量。 調整worker_processes和worker_connections參數(shù) ...

    EsgynChina 評論0 收藏0

發(fā)表評論

0條評論

最新活動
閱讀需要支付1元查看
<