ngx_http_geo_module
ngx_http_geo_module模塊使用取決於客戶端IP地址的值創建變量。
語法:geo [
$address
] $variable
{ ... }
默認值:無
應用位置:http
作用:定義從指定的變量獲取客戶端的IP地址。默認情況下,nginx從$remote_addr變量取得客戶端IP地址,但也可以從其他變量獲得。
案例:
geo $geo { default 0; 127.0.0.1 2; 192.168.1.0/24 1; 10.1.0.0/16 1; } http { geo $arg_boy $ttlsa_com { default 0; 127.0.0.1 1; 8.8.8.8 2; } server { listen 8080; server_name www.test.com; location /hello { default_type text/plain; echo $ttlsa_com; # 必須編譯 nginx echo 模塊 echo $arg_boy; } } } # curl 127.0.0.1:8080/hello?boy=8.8.8.8 2 8.8.8.8
ngx_http_geoip_module
安裝:
模塊默認沒有安裝,如需安裝請執行以下命令:
yum install nginx-module-geoip.x86_64 -y
配置案例:
http { geoip_country GeoIP.dat; geoip_city GeoLiteCity.dat; geoip_proxy 192.168.100.0/24; geoip_proxy_recursive on; ...
參數詳解:
geoip_country
語法:geoip_country
file
;
默認值:無
應用位置:http
作用:根據客戶端IP地址,指定用於確定國家/地區的數據庫。 使用此數據庫時,以下變量可用:
$geoip_country_code two-letter country code, for example, “RU”, “US”. $geoip_country_code3 three-letter country code, for example, “RUS”, “USA”. $geoip_country_name country name, for example, “Russian Federation”, “United States”.
geoip_city
語法:geoip_city
file
;
默認值:無
應用位置:http
作用:指定用於根據客戶端IP地址確定國家,地區和城市的數據庫。 使用此數據庫時,以下變量可用:
$geoip_area_code telephone area code (US only). $geoip_city_continent_code two-letter continent code, for example, “EU”, “NA”. $geoip_city_country_code two-letter country code, for example, “RU”, “US”. $geoip_city_country_code3 three-letter country code, for example, “RUS”, “USA”. $geoip_city_country_name country name, for example, “Russian Federation”, “United States”. $geoip_dma_code DMA region code in US (also known as “metro code”), according to the geotargeting in Google AdWords API. $geoip_latitude latitude. $geoip_longitude longitude. $geoip_region two-symbol country region code (region, territory, state, province, federal land and the like), for example, “48”, “DC”. $geoip_region_name country region name (region, territory, state, province, federal land and the like), for example, “Moscow City”, “District of Columbia”. $geoip_city city name, for example, “Moscow”, “Washington”. $geoip_postal_code postal code.
ngx_http_limit_conn_module
模塊用於限制每個定義的鍵的連接數,特別是每個IP的連接數,對於每個http請求,只有當請求的header被完全讀取的時候,才被計算作1個鏈接數。
參數詳解:
limit_conn
語法:limit_conn
zone
number
;
默認值:無
應用位置:http
, server
, location
作用:設置共享內存區域和給定鍵值的最大允許連接數。 超過此限制時,服務器將返回錯誤以回復請求
limit_conn_zone
語法:limit_conn_zone
key
zone
=name
:size
;
默認值:無
應用位置:http
作用:設置共享內存區域的參數,該區域將保留各種鍵的狀態。 特別是,狀態包括當前的連接數。 密鑰可以包含文本,變量及其組合。 具有空鍵值的請求不計算在內。
limit_conn_status
語法:limit_conn_status
code
;
默認值:limit_conn_status 503;
應用位置:http
, server
, location
作用:設置響應拒絕的請求而返回的狀態代碼。
綜合案例:
limit_conn_zone $binary_remote_addr zone=perip:10m; limit_conn_zone $server_name zone=perserver:10m; server { ... limit_conn perip 10; limit_conn perserver 100; }
ngx_http_limit_req_module
ngx_http_limit_req_module 模塊用於限制對每個定義鍵的請求處理速率,例如,單客戶端IP的每秒請求數。實現的原理是使用“漏桶”原理。
指令詳解:
limit_req
語法:limit_req
zone
=name
[burst
=number
] [nodelay
]
默認值:無
應用位置:http
, server
, location
作用:設置共享內存區域和請求的最大突發大小。 如果請求速率超過為區域配置的速率,則延遲其處理,以便以定義的速率處理請求。 過多的請求被延遲,直到它們的數量超過最大突發大小,在這種情況下請求以錯誤終止。 默認情況下,最大突發大小等於零。
limit_req_zone
語法:limit_req_zone
key
zone
=name
:size
rate
=rate
[sync
];
默認值:無
應用位置:http
作用:設置共享內存區域的參數,該區域將保留各種鍵的狀態。 特別是,狀態存儲當前的過多請求數。 密鑰可以包含文本,變量及其組合。 具有空鍵值的請求不計算在內。
limit_req_status
語法:limit_req_status
code
;
默認值:無
應用位置:http
, server
, location
作用:設置響應拒絕的請求而返回的狀態代碼。
案例:
limit_req_zone $binary_remote_addr zone=perip:10m rate=1r/s; limit_req_zone $server_name zone=perserver:10m rate=10r/s; server { ... limit_req zone=perip burst=5 nodelay; # 1 秒一次,最大延遲請求數量不大於5. 超過五次的返回錯誤碼。 添加 nodelay,不會使用延遲請求數,直接返回錯誤碼. limit_req zone=perserver burst=10; }
ngx_http_log_module
ngx_http_log_module模塊以指定的格式寫入請求日志.
指令詳解:
access_log
語法:access_log
path
[format
[buffer
=size
] [gzip[=
] [level
]flush
=time
] [if
=condition
]]; access_log
off
;
默認值:access_log logs/access.log combined;
應用位置:http
, server
, location
, if in location
, limit_except
作用:設置緩沖日志寫入的路徑,格式和配置。 可以在同一級別指定多個日志。 可以通過在第一個參數中指定“syslog:”前綴來配置記錄到syslog。 特殊值off取消當前級別的所有access_log指令。 如果未指定格式,則使用預定義的“組合”格式。
log_format
語法:log_format
name
[escape
=default
|json
|none
] string
...;
默認值:log_format combined "...";
應用位置:http
作用:指定日志格式
日志格式包含的變量:
$bytes_sent the number of bytes sent to a client $connection connection serial number $connection_requests the current number of requests made through a connection (1.1.18) $msec time in seconds with a milliseconds resolution at the time of the log write $pipe “p” if request was pipelined, “.” otherwise $request_length request length (including request line, header, and request body) $request_time request processing time in seconds with a milliseconds resolution; time elapsed between the first bytes were read from the client and the log write after the last bytes were sent to the client $status response status $time_iso8601 local time in the ISO 8601 standard format $time_local local time in the Common Log Format # 配置案例 log_format combined '$remote_addr - $remote_user [$time_local] ' '"$request" $status $body_bytes_sent ' '"$http_referer" "$http_user_agent"';
open_log_file_cache
語法:open_log_file_cache
max
=N
[inactive
=time
] [min_uses
=N
] [valid
=time
]; open_log_file_cache
off
;
默認值:open_log_file_cache off;
應用位置:http
, server
, location
作用:定義一個緩存,用於存儲名稱中包含變量的常用日志的文件描述符。
常用參數:
max sets the maximum number of descriptors in a cache; if the cache becomes full the least recently used (LRU) descriptors are closed 設置緩存中的最大文件描述符數量,如果緩存被占滿,采用LRU算法將描述符關閉。 inactive sets the time after which the cached descriptor is closed if there were no access during this time; by default, 10 seconds 設置存活時間,默認是10s min_uses sets the minimum number of file uses during the time defined by the inactive parameter to let the descriptor stay open in a cache; by default, 1 設置在inactive時間段內,日志文件最少使用多少次后,該日志文件描述符記入緩存中,默認是1次 valid sets the time after which it should be checked that the file still exists with the same name; by default, 60 seconds 設置檢查頻率,默認60s off disables caching # 配置案例 open_log_file_cache max=1000 inactive=20s valid=1m min_uses=2;
ngx_http_map_module
ngx_http_map_module模塊創建的變量的值取決於其他變量的值。更多...
ngx_http_map_module模塊可以創建變量,這些變量的值與另外的變量值相關聯。允許分類或者同時映射多個值到多個不同值並儲存到一個變量中,map指令用來創建變量,但是僅在變量被接受的時候執行視圖映射操作,對於處理沒有引用變量的請求時,這個模塊並沒有性能上的缺失。
指令詳解:
map
語法:map
string
$variable
{ ... }
默認值:無
應用位置:http
作用:map為一個變量設置的映射表。映射表由兩列組成,匹配模式和對應的值。
在 map 塊里的參數指定了源變量值和結果值的對應關系。
匹配模式可以是一個簡單的字符串或者正則表達式,使用正則表達式要用('~')。
一個正則表達式如果以 “~” 開頭,表示這個正則表達式對大小寫敏感。以 “~*”開頭,表示這個正則表達式對大小寫不敏感。
配置案例:
map $http_user_agent $agent { default ""; ~curl curl; ~*apachebench" ab; }
map_hash_bucket_size
語法:map_hash_bucket_size size;
默認值:map_hash_bucket_size 32|64|128;
應用位置:http
作用:設置映射變量在哈希表的存儲區大小。 默認值取決於處理器的緩存行大小。
map_hash_max_size
語法:map_hash_max_size
size
;
默認值:map_hash_max_size 2048;
應用位置:http
作用:設置映射變量哈希表的最大大小。 設置哈希表的詳細信息在單獨的文檔中提供。
ngx_http_mirror_module
ngx_http_mirror_module模塊(1.13.4)通過創建后台鏡像子請求來實現原始請求的鏡像。 忽略對鏡像子請求的響應。
指令詳解:
mirror
語法:mirror
uri
| off
;
默認值:mirror off;
應用位置:http
, server
, location
作用:設置將鏡像原始請求的URI。 可以在同一級別指定多個鏡像。
mirror_request_body
語法:mirror_request_body
on
| off
;
默認值:mirror_request_body on;
應用位置:http
, server
, location
作用:指示是否鏡像客戶端請求正文。 啟用后,將在創建鏡像子請求之前讀取客戶端請求正文。 在這種情況下,將禁用由proxy_request_buffering,fastcgi_request_buffering,scgi_request_buffering和uwsgi_request_buffering指令設置的無緩沖客戶機請求正文代理。
配置案例:
location / { mirror /mirror; proxy_pass http://backend; } location = /mirror { internal; # 內部調用,外部無法調用. proxy_pass http://test_backend$request_uri; }
ngx_http_proxy_module
ngx_http_proxy_module模塊允許將請求傳遞到另一台服務器。
指令詳解:
proxy_buffer_size
語法:proxy_buffer_size
size
;
默認值:proxy_buffer_size 4k|8k;
應用位置:http
, server
, location
作用:設置用於讀取從代理服務器接收的響應的第一部分的緩沖區的大小。 這部分通常包含一個小的響應頭。 默認情況下,緩沖區大小等於一個內存頁面。 這是4K或8K,具體取決於平台。 然而,它可以做得更小。
proxy_buffering
語法:proxy_buffering
on
| off
;
默認值:proxy_buffering on;
應用位置:http
, server
, location
作用:啟用或禁用來自代理服務器的響應緩沖。
proxy_buffers
語法:proxy_buffers
number
size
;
默認值:proxy_buffers 8 4k|8k;
應用位置:http
, server
, location
作用:設置用於從代理服務器讀取響應的緩沖區的數量和大小,用於單個連接。 默認情況下,緩沖區大小等於一個內存頁面。 這是4K或8K,具體取決於平台。
proxy_busy_buffers_size
語法:proxy_busy_buffers_size
size
;
默認值:proxy_busy_buffers_size 8k|16k;
應用位置:http
, server
, location
作用:高負荷下緩沖區的大小。通常設置為 proxy_buffer_size 的兩倍.
proxy_cache
語法:proxy_cache
zone
| off
;
默認值:proxy_cache off;
應用位置:http
, server
, location
作用:定義用於緩存的共享內存區域。 可以在多個地方使用相同的區域。 參數值可以包含變量(1.7.9)。 off參數禁用從先前配置級別繼承的高速緩存。
proxy_cache_bypass
語法:proxy_cache_bypass
string
...;
默認值:無
應用位置:http
, server
, location
作用:定義不從緩存中獲取響應的條件。 如果字符串參數的至少一個值不為空且不等於“0”,則不會從緩存中獲取響應。
案例:
proxy_cache_bypass $cookie_nocache $arg_nocache$arg_comment; proxy_cache_bypass $http_pragma $http_authorization;
proxy_cache_key
語法:proxy_cache_key
string
;
默認值:proxy_cache_key $scheme$proxy_host$request_uri;
應用位置:http
, server
, location
作用: 定義緩存的鍵.
proxy_cache_lock
語法:proxy_cache_lock
on
| off
;
默認值:proxy_cache_lock off;
應用位置:http
, server
, location
作用:當啟用時,一次只允許一個請求通過向代理服務器傳遞請求來填充根據proxy_cache_key指令標識的新緩存元素。同一緩存元素的其他請求要么等待響應出現在緩存中,要么等待釋放該元素的緩存鎖,直到proxy_cache_lock_timeout指令設置的時間。
proxy_cache_lock_age
語法:proxy_cache_lock_age
time
;
默認值:proxy_cache_lock_age 5s;
應用位置:http
, server
, location
作用:如果傳遞給代理服務器以填充新緩存元素的最后一個請求在指定時間內沒有完成,則可以將另一個請求傳遞給代理服務器。
proxy_cache_lock_timeout
語法:proxy_cache_lock_timeout
time
;
默認值:proxy_cache_lock_timeout 5s;
應用位置:http
, server
, location
作用:設置proxy_cache_lock的超時。 當時間到期時,請求將被傳遞給代理服務器,但是,響應將不會被緩存。
proxy_cache_methods
語法:proxy_cache_methods
GET
| HEAD
| POST
...;
默認值:proxy_cache_methods GET HEAD;
應用位置:http
, server
, location
作用:如果此指令中列出了客戶端請求方法,則將緩存響應。
proxy_cache_min_uses
語法:proxy_cache_min_uses
number
;
默認值:proxy_cache_min_uses 1;
應用位置:http
, server
, location
作用:該指令指定在一個響應被緩存之前最少的請求數。
proxy_cache_path
語法:proxy_cache_path
path
[levels
=levels
] [use_temp_path
=on
|off
] keys_zone
=name
:size
[inactive
=time
] [max_size
=size
] [manager_files
=number
] [manager_sleep
=time
] [manager_threshold
=time
] [loader_files
=number
] [loader_sleep
=time
] [loader_threshold
=time
] [purger
=on
|off
] [purger_files
=number
] [purger_sleep
=time
] [purger_threshold
=time
];
默認值:無
應用位置:http
作用:設置緩存的路徑和其他參數。 緩存數據存儲在文件中。 緩存中的文件名是將MD5功能應用於緩存鍵的結果。 levels參數定義高速緩存的層次結構。
案例:
proxy_cache_path /data/nginx/cache levels=1:2 keys_zone=one:10m;
proxy_cache_purge
語法:proxy_cache_purge string ...;
默認值:無
應用位置:http
, server
, location
作用:定義將請求視為緩存清除請求的條件。 如果字符串參數的至少一個值不為空並且不等於“0”,則移除具有相應高速緩存鍵的高速緩存條目。 通過返回204(無內容)響應來指示成功操作的結果。
案例:
proxy_cache_path /data/nginx/cache keys_zone=cache_zone:10m; map $request_method $purge_method { PURGE 1; default 0; } server { ... location / { proxy_pass http://backend; proxy_cache cache_zone; proxy_cache_key $uri; proxy_cache_purge $purge_method; } }
proxy_cache_use_stale
語法:proxy_cache_use_stale
error
| timeout
| invalid_header
| updating
| http_500
| http_502
| http_503
| http_504
| http_403
| http_404
| http_429
| off
...;
默認值:proxy_cache_use_stale off;
應用位置:http
, server
, location
作用:確定在與代理服務器通信期間可以在哪些情況下使用過時的緩存響應。 該指令的參數與proxy_next_upstream指令的參數匹配。
如果無法選擇代理服務器來處理請求,則error參數還允許使用過時的緩存響應。proxy_cache_valid
語法:proxy_cache_valid [
code
...] time
;
默認值:無
應用位置:http
, server
, location
作用:設置不同響應代碼的緩存時間。
案例:
proxy_cache_valid 200 302 10m; # 10m 代表緩存保存的時間. proxy_cache_valid 404 1m;
proxy_connect_timeout
語法:proxy_connect_timeout
time
;
默認值:proxy_connect_timeout 60s;
應用位置:http
, server
, location
作用:定義與代理服務器建立連接的超時。 應該注意,此超時通常不會超過75秒。
proxy_http_version
語法:proxy_http_version
1.0
| 1.1
;
默認值:proxy_http_version 1.0;
應用位置:http
, server
, location
作用:設置代理的HTTP協議版本。 默認情況下,使用版本1.0。 建議將1.1版與keepalive連接和NTLM身份驗證配合使用。
proxy_ignore_client_abort
語法:proxy_ignore_client_abort
on
| off
;
默認值:proxy_ignore_client_abort off;
應用位置:http
, server
, location
作用:確定當客戶端不等待響應而關閉連接時,是否應該關閉與FastCGI服務器的連接。如果設置為 on,客戶端放棄連接后,nginx 將不會放棄同 Proxy 服務器的連接。
proxy_intercept_errors
語法:proxy_intercept_errors
on
| off
;
默認值:proxy_intercept_errors off;
應用位置:http
, server
, location
作用:如果啟用該指令,nginx 將會顯示 error_page 指令配置信息,而不是直接來自 Proxy 服務器的響應
proxy_max_temp_file_size
語法:proxy_max_temp_file_size
size
;
默認值:proxy_max_temp_file_size 1024m;
應用位置:http
, server
, location
作用:當啟用來自代理服務器的響應緩沖,並且整個響應不適合proxy_buffer_size和proxy_buffers指令設置的緩沖區時,響應的一部分可以保存到臨時文件中。 該指令設置臨時文件的最大大小。 一次寫入臨時文件的數據大小由proxy_temp_file_write_size指令設置。proxy_method
語法:proxy_method
method
;
默認值:無
應用位置:http
, server
, location
作用:指定在轉發到代理服務器的請求中使用的HTTP方法,而不是客戶端請求中的方法。 參數值可以包含變量(1.11.6)。
proxy_next_upstream
語法:proxy_next_upstream
error
| timeout
| invalid_header
| http_500
| http_502
| http_503
| http_504
| http_403
| http_404
| http_429
| non_idempotent
| off
...;
默認值:proxy_next_upstream error timeout;
應用位置:http
, server
, location
作用:指定應將請求傳遞到下一個服務器的條件。
error an error occurred while establishing a connection with the server, passing a request to it, or reading the response header; timeout a timeout has occurred while establishing a connection with the server, passing a request to it, or reading the response header; invalid_header a server returned an empty or invalid response; http_500 a server returned a response with the code 500; http_502 a server returned a response with the code 502; http_503 a server returned a response with the code 503; http_504 a server returned a response with the code 504; http_403 a server returned a response with the code 403; http_404 a server returned a response with the code 404; http_429 a server returned a response with the code 429 (1.11.13);
proxy_next_upstream_timeout
語法:proxy_next_upstream_timeout
time
;
默認值:proxy_next_upstream_timeout 0;
應用位置:http
, server
, location
作用:限制請求可以傳遞到下一個服務器的時間。 0值關閉此限制。
proxy_next_upstream_tries
語法:proxy_next_upstream_tries
number
;
默認值:proxy_next_upstream_tries 0;
應用位置:http
, server
, location
作用:限制將請求傳遞到下一個服務器的可能嘗試次數。 0值關閉此限制。
proxy_no_cache
語法:proxy_no_cache
string
...;
默認值:無
應用位置:http
, server
, location
作用:定義不將響應保存到緩存的條件。 如果字符串參數的至少一個值不為空且不等於“0”,則不會保存響應。
案例:
proxy_no_cache $cookie_nocache $arg_nocache$arg_comment; proxy_no_cache $http_pragma $http_authorization;
proxy_pass
語法:proxy_pass
URL
;
默認值:無
應用位置:location
, if in location
, limit_except
作用:設置代理服務器的協議和地址,以及應該映射位置的可選URI。作為協議,可以指定“http”或“https”。地址可以指定為一個域名或IP地址,以及一個可選端口。
案例:
proxy_pass http://localhost:8000/uri/; location /name/ { proxy_pass http://127.0.0.1/remote/; } location /some/path/ { proxy_pass http://127.0.0.1; } location /name/ { rewrite /name/([^/]+) /users?name=$1 break; proxy_pass http://127.0.0.1; } location /name/ { proxy_pass http://127.0.0.1$request_uri; }
proxy_pass_request_body
語法:proxy_pass_request_body
on
| off
;
默認值:proxy_pass_request_body on;
應用位置:http
, server
, location
作用:指示是否將原始請求正文傳遞給代理服務器。(我的理解是通過代理服務器)
location /x-accel-redirect-here/ { proxy_method GET; proxy_pass_request_body off; proxy_set_header Content-Length ""; proxy_pass ... }
proxy_pass_request_headers
語法:proxy_pass_request_headers
on
| off
;
默認值:proxy_pass_request_headers on;
應用位置:http
, server
, location
作用:指示是否將原始請求的標頭字段傳遞給代理服務器。
案例:
location /x-accel-redirect-here/ { proxy_method GET; proxy_pass_request_headers off; proxy_pass_request_body off; proxy_pass ... }
proxy_read_timeout
語法:proxy_read_timeout
time
;
默認值:proxy_read_timeout 60s;
應用位置:http
, server
, location
作用:定義從代理服務器讀取響應的超時。 僅在兩個連續的讀操作之間設置超時,而不是為整個響應的傳輸。 如果代理服務器在此時間內未傳輸任何內容,則關閉連接。
proxy_redirect
語法:proxy_redirect
default
; proxy_redirect
off
; proxy_redirect
redirect
replacement
;
默認值:proxy_redirect default;
應用位置:http
, server
, location
作用:如果需要修改從被代理服務器傳來的應答頭中的"Location"和"Refresh"字段,可以用這個指令設置。 默認即可,更多
案例:
location /one/ { proxy_pass http://upstream:port/two/; proxy_redirect default; location /one/ { proxy_pass http://upstream:port/two/; proxy_redirect http://upstream:port/two/ /one/; proxy_redirect http://localhost:8000/ http://$host:$server_port/;
proxy_request_buffering
語法:proxy_request_buffering
on
| off
;
默認值:proxy_request_buffering on;
應用位置:http
, server
, location
作用:啟用或禁用客戶端請求體的緩沖。
proxy_send_timeout
語法:proxy_send_timeout
time
;
默認值:proxy_send_timeout 60s;
應用位置:http
, server
, location
作用:設置向代理服務器發送請求的超時。超時只設置在兩個連續的寫操作之間,而不是整個請求的傳輸。如果代理服務器在此期間沒有接收到任何信息,則連接將關閉。
proxy_set_body
語法:proxy_set_body
value
;
默認值:無
應用位置:http
, server
, location
作用:允許重新定義傳遞給代理服務器的請求體。值可以包含文本、變量及其組合。
proxy_set_header
語法:proxy_set_header
field
value
;
默認值:proxy_set_header Host $proxy_host;
proxy_set_header Connection close;
應用位置:http
, server
, location
作用: 允許重新定義或附加字段到傳遞給代理服務器的請求標頭。該值可以包含文本、變量及其組合。當且僅當當前級別上沒有定義proxy_set_header指令時,這些指令才能從上一級別繼承。
proxy_socket_keepalive
語法:proxy_socket_keepalive
on
| off
;
默認值:proxy_socket_keepalive off;
應用位置:http
, server
, location
作用:配置到代理服務器的傳出連接的“TCP保持活動”行為。默認情況下,操作系統的設置對套接字有效。如果指令被設置為“on”,那么SO_KEEPALIVE套接字選項將為套接字打開。
proxy_ssl_certificate
語法:proxy_ssl_certificate
file
;
默認值:無
應用位置:http
, server
, location
作用:指定具有PEM格式的證書的文件,該證書用於對代理的HTTPS服務器進行身份驗證。
proxy_ssl_certificate_key
語法:proxy_ssl_certificate_key
file
;
默認值:無
應用位置:http
, server
, location
作用:指定具有PEM格式的密鑰的文件,用於對代理的HTTPS服務器進行身份驗證。 更多
proxy_ssl_ciphers
語法:proxy_ssl_ciphers
ciphers
;
默認值:無
應用位置:http
, server
, location
作用:指定對已代理HTTPS服務器的請求啟用的密碼。密碼是按照OpenSSL庫理解的格式指定的。(也就是加密算法)
proxy_ssl_crl
語法:proxy_ssl_crl
file
;
默認值:無
應用位置:http
, server
, location
作用:指定一個文件,該文件具有已撤銷證書(CRL),格式為PEM,用於驗證已代理HTTPS服務器的證書。
proxy_ssl_name
語法:proxy_ssl_name
name
;
默認值:proxy_ssl_name $proxy_host;
應用位置:http
, server
, location
作用:允許覆蓋用於驗證代理HTTPS服務器證書的服務器名稱,並在與代理HTTPS服務器建立連接時通過SNI傳遞。
默認情況下,使用proxy_pass URL的主機部分。
proxy_ssl_password_file
語法:proxy_ssl_password_file
file
;
默認值:無
應用位置:http
, server
, location
作用:指定一個文件,其中每個密碼子在單獨的行上指定。在加載密鑰時依次嘗試密碼。
proxy_ssl_protocols
語法:proxy_ssl_protocols [
SSLv2
] [SSLv3
] [TLSv1
] [TLSv1.1
] [TLSv1.2
] [TLSv1.3
];
默認值:proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
應用位置:http
, server
, location
作用:為請求代理的HTTPS服務器啟用指定的協議。
proxy_ssl_server_name
語法:proxy_ssl_server_name
on
| off
;
默認值:proxy_ssl_server_name off;
應用位置:http
, server
, location
作用:在與代理HTTPS服務器建立連接時,啟用或禁用通過TLS服務器名稱指示擴展(SNI, RFC 6066)傳遞服務器名稱。
proxy_ssl_session_reuse
語法:proxy_ssl_session_reuse
on
| off
;
默認值:proxy_ssl_session_reuse on;
應用位置:http
, server
, location
】
作用:確定在使用代理服務器時是否可以重用SSL會話。 如果日志中出現“SSL3_GET_FINISHED:摘要檢查失敗”錯誤,請嘗試禁用會話重用。
proxy_ssl_trusted_certificate
語法:proxy_ssl_trusted_certificate
file
;
默認值:無
應用位置:http
, server
, location
作用:以PEM格式指定具有受信任CA證書的文件,該文件用於驗證經過代理的HTTPS服務器的證書。
proxy_ssl_verify
語法:proxy_ssl_verify
on
| off
;
默認值:proxy_ssl_verify off;
應用位置:http
, server
, location
作用:啟用或禁用是否驗證代理HTTPS服務器證書。
proxy_ssl_verify_depth
語法:proxy_ssl_verify_depth
number
;
默認值:proxy_ssl_verify_depth 1;
應用位置:http
, server
, location
作用:在已代理的HTTPS服務器證書鏈中設置驗證深度。
proxy_store
語法:proxy_store
on
| off
| string
;
默認值:proxy_store off;
應用位置:http
, server
, location
作用:允許將文件保存到磁盤。(無法根據規則自動清除緩存) on參數使用與指令別名或root對應的路徑保存文件。 off參數禁用文件保存。 此外,可以使用帶變量的字符串顯式設置文件名:
proxy_store /data/www$original_uri;
案例:
location /images/ { root /data/www; error_page 404 = /fetch$uri; } location /fetch/ { internal; proxy_pass http://backend/; proxy_store on; proxy_store_access user:rw group:rw all:r; proxy_temp_path /data/temp; alias /data/www/; } location /images/ { root /data/www; error_page 404 = @fetch; } location @fetch { internal; proxy_pass http://backend; proxy_store on; proxy_store_access user:rw group:rw all:r; proxy_temp_path /data/temp; root /data/www; }
proxy_store_access
語法:proxy_store_access
users
:permissions
...;
默認值:proxy_store_access user:rw;
應用位置:http
, server
, location
作用 :為新創建的文件和目錄設置訪問權限,例如:
proxy_store_access user:rw group:rw all:r;
proxy_temp_file_write_size
語法:proxy_temp_file_write_size
size
;
默認值:proxy_temp_file_write_size 8k|16k;
應用位置:http
, server
, location
作用:當啟用從代理服務器到臨時文件的響應緩沖時,限制一次寫入臨時文件的數據大小。 默認情況下,size由proxy_buffer_size和proxy_buffers指令設置的兩個緩沖區限制。 臨時文件的最大大小由proxy_max_temp_file_size指令設置。
proxy_temp_path
語法:proxy_temp_path
path
[level1
[level2
[level3
]]];
默認值:proxy_temp_path proxy_temp;
應用位置:http
, server
, location
作用:定義用於存儲臨時文件的目錄,其中包含從代理服務器接收的數據。 在指定目錄下最多可以使用三級子目錄層次結構。 for proxy_store