Nginx Wiki(已过时最新:http://nginxorg/en/docs/)
程序员文章站
2022-04-08 23:00:08
...
location / { proxy_pass http://localhost:8000; proxy_set_header X-Real-IP $remote_addr;}
proxy_bind 192.168.1.1;
server
location
This directive set the buffer size, into which will be read the first part of the response, obtained from the proxied server.
server
location
This directive activate response buffering of the proxied server.
server
location
This directive sets the number and the size of buffers, into which will be read the answer, obtained from the proxied server. By default, the size of one buffer is equal to the size of page. Depending on platform this is either 4K or 8K.
server
location
server
location
This directive sets name of zone for caching. The same zone can be used in multiple places.
server
location
The directive specifies the conditions under which the answer will not be taken from the cache. If at least one of a string variable is not empty and not equal to "0", the answer is not taken from the cache:
proxy_cache_bypass $cookie_nocache$arg_nocache$arg_comment; proxy_cache_bypass $http_pragma$http_authorization;
proxy_cache_bypass $http_my_secret_header;
server
location
The directive specifies what information is included in the key for caching, for example
proxy_cache_key "$host$request_uri$cookie_user";
proxy_cache_key "$scheme$host$request_uri";
server
location
server
location
proxy_cache_methods POST;
server
location
Number of queries, after which reply will be cached.
This directive sets the cache path and other cache parameters. Cached data is stored in files. An MD5 hash of the proxied URL is used as the key for the cache entry, and is also used as the filename in the cache path for the response contents and metadata. The levels parameter sets the number of subdirectory levels in cache. For example:
proxy_cache_path /data/nginx/cache/one levels=1:2 keys_zone=one:10m;
/data/nginx/cache/c/29/b7f54b2df7773722d382f4809d65029c
proxy_cache_path /data/nginx/cache/one levels=1 keys_zone=one:10m; proxy_cache_path /data/nginx/cache/two levels=2:2 keys_zone=two:100m; proxy_cache_path /data/nginx/cache/three levels=1:1:2 keys_zone=three:1000m;
server
location
This directive tells Nginx when to serve a stale item from the proxy cache. The parameters for this directive are similar to proxy_next_upstream with the addition of 'updating'.
server
location
This directive sets the time for caching different replies. Example:
proxy_cache_valid 200302 10m; proxy_cache_valid 404 1m;
proxy_cache_valid 5m;
proxy_cache_valid 200302 10m; proxy_cache_valid 301 1h; proxy_cache_valid any 1m;
proxy_ignore_headers X-Accel-Expires Expires Cache-Control;
server
location
This directive assigns a timeout for the connection to the upstream server. It is necessary to keep in mind that this time out cannot be more than 75 seconds.
proxy_cookie_domain domain replacement
server
location
proxy_cookie_path path replacement
server
location
This determines the limit of the header name. If you use header names longer than 64 characters then increase this.
Should not be smaller than the amount of headers your back-end is setting.
server
location
nginx does not transfer the "Date", "Server", "X-Pad" and "X-Accel-..." header lines from the proxied server response. The
location / { proxy_hide_header X-AspNet-Version; proxy_hide_header MicrosoftOfficeWebServer;}
location / { proxy_pass http://backend_servers;} location /files/ { proxy_pass http://fileserver; proxy_hide_header Content-Type;}
server
location
server
location
Prevents aborting request to proxy in case the client itself aborts the request.
server
location
Prohibits the processing of the header lines from the proxy server's response.
server
location
This directive decides if nginx will intercept responses with HTTP status codes of 400 and higher.
server
location
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.
proxy_method POST;
server
location
Directive determines in what cases the request will be transmitted to the next server:
server
location
Specifies in what cases a response will not be cached, e.g.
proxy_no_cache $cookie_nocache$arg_nocache$arg_comment; proxy_no_cache $http_pragma$http_authorization;
if in location
limit_except
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 http://localhost:8000/uri/;
proxy_pass http://unix:/path/to/backend.socket:/uri/;
proxy_set_header Host $host;
声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。
相关文章
相关视频
专题推荐
-
独孤九贱-php全栈开发教程
全栈 170W+
主讲:Peter-Zhu 轻松幽默、简短易学,非常适合PHP学习入门
-
玉女心经-web前端开发教程
入门 80W+
主讲:灭绝师太 由浅入深、明快简洁,非常适合前端学习入门
-
天龙八部-实战开发教程
实战 120W+
主讲:西门大官人 思路清晰、严谨规范,适合有一定web编程基础学习
- 最新文章
- 热门排行
上一篇: php函数分为几种
下一篇: PHP如何安装pear扩展及解压技巧
网友评论
文明上网理性发言,请遵守 新闻评论服务协议
我要评论