proxy_cache_path /data/nginx/cache/one levels<span>=</span><span>1</span> keys_zone<span>=</span>one:10m<span>;</span>
proxy_cache_path /data/nginx/cache/two levels<span>=</span><span>2</span>:<span>2</span> keys_zone<span>=</span>two:100m<span>;</span>
proxy_cache_path /data/nginx/cache/three levels<span>=</span><span>1</span>:<span>1</span>:<span>2</span> keys_zone<span>=</span>three:1000m<span>;</span>
If cached data is not requested for time defined by the inactive parameter, than that data is removed from the cache. The inactive parameter defaults to
10 minutes (10m).A special process, called "cache manager", is created to control the on-disk cache. It is responsible for removing inactive items and enforcing the size of the cache, as defined by the parameter max_size.
When the total size of the cache exceeds the maximum size set by max_size, the least recently used data in the cache is deleted to make room for a new cache entry (a LRU replacement policy).Zone size should be set proportional to number of pages to cache. The size of the metadata for one page (file) depends on the OS; currently it is 64 bytes for FreeBSD/i386, and 128 bytes for FreeBSD/amd64.The directories specified by proxy_cache_path and proxy_temp_path should
be located on the same filesystem.proxy_cache_use_stale
Syntax: |
proxy_cache_use_stale error | timeout | invalid_header | updating | http_500 | http_502 | http_503 | http_504 | http_404 | off ...
|
Default: |
off |
Context: |
http server location |
Reference: |
proxy_cache_use_stale |
이 지시문은 프록시 캐시에서 오래된 항목을 제공할 시기를 Nginx에 알려줍니다. 이 지시어의 매개변수는 다음을 포함하는proxy_next_upstream과 유사합니다.
'updating'이 추가되었습니다.캐시 스탬프를 방지하려면(여러 스레드가 캐시를 동시에 업데이트하려고 시도하는 경우) 'updating' 매개변수를 지정할 수 있습니다. 이로 인해 하나의 스레드가 캐시를 업데이트하고 업데이트가 진행되는 동안 다른 모든 스레드가 캐시를 업데이트하게 됩니다.
캐시에 있는 것의 오래된 버전.proxy_cache_valid
Syntax: |
proxy_cache_valid [ code ...] time
|
Default: |
|
Context: |
http server location |
Reference: |
proxy_cache_valid |
구문: |
proxy_cache_valid [ 코드 . ..] 시간 |
기본값: |
|
컨텍스트: |
http서버위치 |
참조: |
proxy_cache_valid |
This directive sets the time for caching different replies. Example:
proxy_cache_valid <span>200</span><span>302</span> 10m<span>;</span>
proxy_cache_valid <span>404</span> 1m<span>;</span>
sets 10 minutes cache time for replies with code 200 and 302, and 1 minute for 404s.If only time is specified:
proxy_cache_valid 5m<span>;</span>
then only replies with codes 200, 301 and 302 will be cached.Also it is possible to cache any replies with parameter "any":
proxy_cache_valid <span>200</span><span>302</span> 10m<span>;</span>
proxy_cache_valid <span>301</span> 1h<span>;</span>
proxy_cache_valid any 1m<span>;</span>
Upstream cache-related directives have priority over proxy_cache_valid value, in particular the order is (from
Igor):X-Accel-Expires
Expires/Cache-Control
proxy_cache_valid
The order in which your backend return HTTP headers change cache behaviour. Read this post for
details.You may ignore the headers using
proxy_ignore_headers X-Accel-Expires Expires Cache-Control<span>;</span>
Concerning If-Modified / Last-Modified since behaviour, please remember that by default nginx sends 304 only if L-M == I-M-S. Controlled by directive if_modified_since [off|exact|before]Note: you must set this option for any persistent caching to occur.proxy_connect_timeout
Syntax: |
proxy_connect_timeout time
|
Default: |
60s |
Context: |
http server location |
Reference: |
proxy_connect_timeout |
이 지시문은 업스트림 서버에 대한 연결 시간 초과를 할당합니다. 이 시간 초과는 75초를 초과할 수 없다는 점을 명심해야 합니다.이 시간은 서버가 페이지를 반환할 때까지의 시간이 아닙니다. 즉, Proxy_read_timeout 문입니다. 만약 당신의
업스트림 서버가 작동 중이지만 정지된 경우(예: 요청을 처리할 스레드가 충분하지 않아 나중에 처리할 연결 풀에 놓이게 됨) 서버에 연결되었으므로 이 명령문은 도움이 되지 않습니다. proxy_cookie_domain
Syntax: |
proxy_cookie_domain off proxy_cookie_domain domain replacement
|
Default: |
off |
Context: |
http server location |
Appeared in: |
1.1.15 |
Reference: |
proxy_cookie_domain |
구문: |
proxy_cookie_domain 끄기 proxy_cookie_domain 도메인 교체
|
기본값:
Syntax: |
proxy_cookie_path off proxy_cookie_path path replacement
|
Default: |
off |
Context: |
http server location |
Appeared in: |
1.1.15 |
Reference: |
proxy_cookie_path |
|
해제 |
컨텍스트: |
http 서버위치 |
출현 날짜: |
1.1.15 |
참조:proxy_cookie_domain |
proxy_cookie_path
구문: |
proxy_cookie_path 끄기 proxy_cookie_path 경로 대체
|
기본값: |
해제 |
컨텍스트: |
http 서버위치 |
출현 날짜: |
1.1.15 |
참조:proxy_cookie_path |
proxy_headers_hash_bucket_size구문: proxy_headers_hash_bucket_size 크기;기본값: proxy_headers_hash_bucket_size 64;컨텍스트: http, 서버, 위치, if이 지시문은 헤더 해시 테이블의 버킷 크기를 설정합니다.
헤더 이름의 제한을 결정합니다. 64자보다 긴 헤더 이름을 사용하는 경우 이를 늘립니다.proxy_headers_hash_max_size구문: proxy_headers_hash_max_size size;기본값: proxy_headers_hash_max_size 512;컨텍스트: http, 서버, 위치, if이 지시문은 헤더 해시 테이블의 최대 크기를 설정합니다.
백엔드가 설정하는 헤더의 양보다 작으면 안 됩니다.proxy_hide_header
Syntax: |
proxy_hide_header field
|
Default: |
|
Context: |
http server location |
Reference: |
proxy_hide_header |
구문: |
proxy_hide_header 필드 td> |
기본값: |
|
컨텍스트: |
http서버위치 |
참조: |
proxy_hide_header |
nginx does not transfer the "Date", "Server", "X-Pad" and "X-Accel-..." header lines from the proxied server response. The proxy_hide_header directive
allows to hide some additional header lines. But if on the contrary the header lines must be passed, then the proxy_pass_header should
be used. For example if you want to hide the MS-OfficeWebserver and the AspNet-Version:
<span>location</span> / <span>{</span>
proxy_hide_header X-AspNet-Version<span>;</span>
proxy_hide_header MicrosoftOfficeWebServer<span>;</span><span>}</span>
This directive can also be very helpful when using X-Accel-Redirect. For example, you may have one set of backend servers
which return the headers for a file download, which includes X-Accel-Redirect to the actual file, as well as the correct Content-Type. However, the Redirect URL points to a files erver which hosts the actual file you wish to serve, and that server sends its
own Content-Type header, which might be incorrect, and overrides the header sent by the original backend servers. You can avoid this by adding the proxy_hide_header directive to the fileserver. Example:
<span>location</span> / <span>{</span>
proxy_pass <span>http</span>://backend_servers<span>;</span><span>}</span>
<span>location</span> /files/ <span>{</span>
proxy_pass <span>http</span>://fileserver<span>;</span>
proxy_hide_header Content-Type<span>;</span><span>}</span>
proxy_http_version
Syntax: |
proxy_http_version 1.0 | 1.1
|
Default: |
1.0 |
Context: |
http server location |
Appeared in: |
1.1.4 |
Reference: |
proxy_http_version |
proxy_ignore_client_abort
Syntax: |
proxy_ignore_client_abort on | off
|
Default: |
off |
Context: |
http server location |
Reference: |
proxy_ignore_client_abort |
클라이언트 자체가 요청을 중단하는 경우 프록시에 대한 요청 중단을 방지합니다.proxy_ignore_headers
Syntax: |
proxy_ignore_headers field ... |
Default: |
|
Context: |
http server location |
Reference: |
proxy_ignore_headers |
구문: |
proxy_ignore_headers 필드 .. .
|
기본값: |
|
컨텍스트: |
http서버위치 |
Syntax: |
proxy_intercept_errors on | off
|
Default: |
off |
Context: |
http server location |
Reference: |
proxy_intercept_errors |
참조: |
proxy_ignore_headers td> |
프록시 서버 응답의 헤더 라인 처리를 금지합니다.문자열을 지정할 수 있습니다. "X-Accel-Redirect", "X-Accel-Expires", "Expires", "Cache-Control" 또는 "Set-Cookie"입니다.
nginx는 Set-Cookie를 사용하여 요청을 캐시하지 않습니다.onerror_pageproxy_intercept_errorserror_page
구문: |
proxy_intercept_errors
Syntax: |
proxy_max_temp_file_size size
|
Default: |
1024m |
Context: |
http server location |
Reference: |
proxy_max_temp_file_size |
| 끄기
|
기본값: |
끄기 |
컨텍스트: |
http서버위치 |
참고: |
proxy_intercept_errors |
이것 지시문은 nginx가 400 이상의 HTTP 상태 코드로 응답을 가로챌지 여부를 결정합니다.기본적으로 모든 응답은 프록시 서버에서 있는 그대로 전송됩니다.이를 그러면 nginx는 지시어에 의해 명시적으로 처리되는 상태 코드를 가로챕니다.
지시문과 일치하지 않는 상태 코드가 있는 응답은 프록시 서버에서 있는 그대로 전송됩니다.proxy_max_temp_file_size
구문: |
proxy_max_temp_file_size size td> |
기본값: |
1024m |
컨텍스트: |
http서버위치 |
참조: |
proxy_max_temp_file_size |
The maximum size of a temporary file when the content is larger than the proxy buffer. If file is larger than this size, it will be served synchronously from upstream server rather than buffered to disk.If proxy_max_temp_file_size is equal to zero, temporary files usage will be disabled.proxy_methodsyntax: proxy_method [method];default: Nonecontext: http, server, locationAllows you to override the HTTP method of the request to be passed to the backend server. If you specify POST for example, all requests forwarded to the backend server will be POST requests.Example:
proxy_method POST<span>;</span>
proxy_next_upstream
Syntax: |
proxy_next_upstream error | timeout | invalid_header | http_500 | http_502 | http_503 | http_504 | http_404 | off ...
|
Default: |
error timeout |
Context: |
http server location |
Reference: |
proxy_next_upstream |
Directive determines in what cases the request will be transmitted to the next server:error — an error has occurred while connecting to the server, sending a request to it, or reading its response;
timeout — occurred timeout during the connection with the server, transfer the request or while reading response from the server;
invalid_header — server returned a empty or incorrect answer;
http_500 — server returned answer with code 500
http_502 — server returned answer with code 502
http_503 — server returned answer with code 503
http_504 — server returned answer with code 504
http_404 — server returned answer with code 404
off — it forbids the request transfer to the next server
Transferring the request to the next server is only possible when nothing has been transferred to the client -- that is, if an error or timeout arises in the middle of the transfer of the request, then it is not possible to retry the current request on a different
server.proxy_no_cache
Syntax: |
proxy_no_cache string ... |
Default: |
|
Context: |
http server location |
Reference: |
proxy_no_cache |
Specifies in what cases a response will not be cached, e.g.
proxy_no_cache <span>$cookie_nocache</span><span>$arg_nocache</span><span>$arg_comment</span><span>;</span>
proxy_no_cache <span>$http_pragma</span><span>$http_authorization</span><span>;</span>
The response is marked uncacheable if any of the arguments expand to anything other than "0" or the empty string. For instance, in the above example, the response will never be cached if the cookie "nocache" is set in the request.proxy_pass
Syntax: |
proxy_pass URL
|
Default: |
|
Context: |
location if in location limit_except |
Reference: |
proxy_pass |
This directive sets the address of the proxied server and the URI to which location will be mapped. Address may be given as hostname or address and port, for example,
proxy_pass <span>http</span>://localhost:<span>8000</span>/uri/<span>;</span>
or as unix socket path:
proxy_pass <span>http</span>://unix:/path/to/backend.socket:/uri/<span>;</span>
path is given after the word unix between two colons.By default, the Host header from the request is not forwarded, but is set based on the proxy_pass statement. To forward the requested Host header, it is necessary to use:
proxy_set_header Host <span>$host</span><span>;</span>
While passing request nginx replaces URI part which corresponds to location with one indicated in proxy_pass direct