Nginx 靜態資源Web服務

2021-08-20 16:23:00 字數 1386 閱讀 6772

注:非伺服器動態生成的檔案

1、瀏覽器端渲染  html、css、js

2、  jpeg、gif、png

1、配置語法-檔案讀取

2、配置語法-tcp_nopush (sendfile開啟情況下,提高網路包傳輸效率)

3、配置語法-tcp_nodelay(keeplive連線下,提高網路包的傳輸實時性)

注:無延遲,適用於對實時性要求較高的場景

4、配置語法-壓縮(壓縮傳輸)

5、配置語法-壓縮(壓縮比,與gzip相配合)

6、配置語法-壓縮(控制協議版本)

注:預設cdn抓取時,只支援1.0版本,這時,就需要將此引數改為1.0

配置示例

server 

location ~ .*\.(txt|xml)$

location ~ ^/download

error_page 500 502 503 504 404 /50x.html;

location=

/50x.html

}

7、配置語法- expires(用於處理瀏覽器快取機制)

注:新增http響應頭資訊  cache-control、expires

Nginx作為靜態資源Web服務

nginx作為靜態資源 cdn分發資源 配置語法 配置語法 將多個資源一起傳送 提高效率 作用 sendfile開啟的情況下 提高網路包的傳輸效率 配置語法 壓縮 nginx壓縮模組 http gzip static module 預讀gzip功能 http gunzip module 應用支援gu...

Nginx服務系列 靜態資源web服務

sendfile on off 預設off http server location if in location tcp nopush on off 預設off http server location sendfile開啟的情況下,提高網路包的傳輸效率 tcp nodelay on off 預設...

Nginx服務系列 靜態資源web服務

sendfile on off 預設off http server location if in location tcp nopush on off 預設off http server location sendfile開啟的情況下,提高網路包的傳輸效率 tcp nodelay on off 預設...