使用Nginx快取網頁

2021-07-11 14:02:18 字數 1642 閱讀 9582

這幾天嘗試使用nginx伺服器,檢視了該伺服器的用途。發現該伺服器可以用來實現反向**和負載均衡等功能,自己通過查詢資料實現了快取網頁的功能,下面是我的nginx的配置檔案的設定,配置檔案的路徑為:/usr/local/nginx/conf/nginx.conf

下面有兩篇關於nginx.conf的詳細介紹:

nginx.conf的完整配置說明

nginx安裝及配置檔案nginx.conf詳解

nginx location 配置總結

nginx的基本配置和虛擬主機的配置

nginx主配置檔案詳解

使用nginx的proxy_cache做**快取

nginx快取功能的設定

nginx配置檔案nginx.conf中文詳解

以下是我的nginx.conf的檔案內容:

#使用者組 使用者

#user nobody;

#工作程序,根據硬體調整

worker_processes 1;

#錯誤日誌

#error_log logs/error.log;

#error_log logs/error.log notice;

#error_log logs/error.log info;

#pid檔案位置

#設定當出現錯誤的時候跳轉的頁面

在重新載入上述修改之後的檔案之前,先在/usr/local/nginx中建立乙個wenserver資料夾:

mkdir webserver

然後執行如下命令:

./nginx -s reload

然後在瀏覽器中輸入nginx的ip位址和埠號即可,訪問網頁。

使用Nginx快取靜態檔案

配置語法 open file cacheoff open file cachemax n inactive time 預設配置 open file cache off 配置環境 配置可以儲存的快取 該指令具有以下引數 maxsets快取中最大元素數 在快取溢位時,刪除最近最少使用的 lru 元素 如...

使用Nginx實現頁面快取

nginx的快取配置比較直觀簡單,具體有下面幾個指令需要知道 格式 proxy cache path path levels numbers keys zone zone name zone size inactive time max size size 說明 path 快取檔案存放的位置 lev...

iOS 取出網頁快取與網頁離線快取

1.取出網頁快取 在viewdidload中,有快取就載入快取,沒快取就從伺服器載入 void viewdidload else 寫入快取 void writetocache 2.網頁離線快取 網頁離線快取就是通過擷取urlprotocol 來實現的。沒有網路的時候會載入快取內容,有網路或者弱網不會...