nginx配置注释
user www www; worker_processes 8; worker_cpu_affinity 00000001 00000010 00000100 00001000 00010000 00100000 01000000 10000000; worker_processes 语法: worker_processes number 缺省值: 1 e.g.: worker_processes 5; nginx has the ability to use more than one worker process for several reasons: nginx可以使用多个worker进程,原因如下: 1. to use SMP 2. to decrease latency when workers blockend on disk I/O 3. to limit number of connections per process when select()/poll() is used The worker_processes and worker_connections from the event sections allows you to calculate maxclients value: k max_clients = worker_processes * worker_connections worker_cpu_affinity 语法: worker_cpu_affinity cpumask [cpumask...] 缺省值: none Linux only. With this option you can bind the worker process to a CPU, it calls sched_setaffinity(). 仅适用于linux,使用该选项可以绑定worker进程和CPU. For example, worker_proceses 4; worker_cpu_affinity 0001 0010 0100 1000; Bind each worker process to one CPU only. 分别给每个worker进程绑定一个CPU. worker_proceses 2; worker_cpu_affinity 0101 1010; Bind the first worker to CPU0/CPU2, bind the second worker to CPU1/CPU3. This is suitable for HTT. 将CPU0/CPU2绑定给第一个worker进程,将CPU1/CPU3绑定给第二个worker进程。 error_log /var/log/nginx/nginx_error.log crit; pid /usr/local/webserver/nginx/nginx.pid; 进程id存储文件。可以使用 kill -HUP cat /var/log/nginx.pid\ 对Nginx进行配置文件重新加载。 worker_rlimit_nofile 65535; events { use epoll; use Syntax: use [ kqueue | rtsig | epoll | /dev/poll | select | poll | eventport ] Default: 如果在./configure的时候指定了不止一种事件模型,那么可以设置其中一个,以便告诉nginx使用哪种事件模型。默认情况下nginx会在./configure时找出最适合系统的事件模型。 你可以在 这里 查看可用的事件模型以及如何在./configure时激活 worker_connections 65535; worker_connections Syntax: worker_connections number Default: 通过worker_connections和worker_proceses可以计算出maxclients: max_clients = worker_processes * worker_connections 作为反向代理,max_clients为: max_clients = worker_processes * worker_connections/4 Since a browser opens 2 connections by default to a server and nginx uses the fds (file descriptors) from the same pool to connect to the upstream backend } http { include mime.types; default_type application/octet-stream; server_names_hash_bucket_size 128; server_names_hash_bucket_size syntax: server_names_hash_bucket_size number default: server_names_hash_bucket_size 32/64/128 context: http Directive assigns the size of basket in the hash-tables of the names of servers. This value by default depends on the size of the line of processor cache. For more detail see the description of tuning the hash tables in Nginx Optimizations. client_header_buffer_size 32k; large_client_header_buffers 4 32k; client_max_body_size 8m; sendfile on; tcp_nopush on; keepalive_timeout 60; tcp_nodelay on; fastcgi_connect_timeout 300; fastcgi_send_timeout 300; fastcgi_read_timeout 300; fastcgi_buffer_size 64k; 语法: fastcgi_buffer_size 大小 默认: fastcgi_buffer_size 4k/8k 环境: http, server, location 该命令设置缓冲区大小,其中将读取第一部分的输出,从fastcgi服务端获取 在这个输出的小输出标头部分的位置,作为一项规则 默认情况下,缓冲区大小是等于一个fastcgi缓冲区大小,允许将其设置为更少 fastcgi_buffers 4 64k; fastcgi_buffers syntax: fastcgi_buffers the_number is_size; default: fastcgi_buffers 8 4k/8k; context: http, server, location 该指令集设置缓冲区的数量和大小,用于缓存从 FastCGI Server 接收到的数据。默认情况下,一个缓冲区的大小相当于一个页面的大小。根据平台的不同设置为4K/8K fastcgi_busy_buffers_size 128k; fastcgi_temp_file_write_size 128k; fastcgi_intercept_errors on; fastcgi_intercept_errors syntax: fastcgi_intercept_errors on|off default: fastcgi_intercept_errors off context: http, server, location 这个指令用来决定是否要把客户端转向4xx和5xx错误页,或允许Nginx自动指定错误页页。 注意:你需要在此明确错误页,它才是有用的。Igor 曾说:“如果没有定制的处理机制,Nginx不会拦截一个没有缺省页的错误。Nginx 只会拦截一些小的错误,放过其他一些。 gzip on; gzip 语法: gzip on|off 默认值: gzip off 作用域: http, server, location, if (x) location 开启或者关闭gzip模块 gzip_min_length 1k; gzip_min_length 语法: gzip_min_length length 默认值: gzip_min_length 0 作用域: http, server, location 设置允许压缩的页面最小字节数,页面字节数从header头中的Content-Length中进行获取。 默认值是0,不管页面多大都压缩。 建议设置成大于1k的字节数,小于1k可能会越压越大。即: gzip_min_length 1024 gzip_buffers 4 16k; gzip_buffers 语法: gzip_buffers number size 默认值: gzip_buffers 4 4k/8k 作用域: http, server, location 设置系统获取几个单位的缓存用于存储gzip的压缩结果数据流。例如 4 4k 代表以4k为单位,按照原始数据大小以4k为单位的4倍申请内存。 4 8k 代表以8k为单位,按照原始数据大小以8k为单位的4倍申请内存。 如果没有设置,默认值是申请跟原始数据相同大小的内存空间去存储gzip压缩结果。 gzip_http_version 1.0; gzip_http_version 语法: gzip_http_version 1.0|1.1 默认值: gzip_http_version 1.1 作用域: http, server, location 识别http的协议版本。由于早期的一些浏览器或者http客户端,可能不支持gzip自解压,用户就会看到乱码,所以做一些判断还是有必要的。注:21世纪都来了,现在除了类似于百度的蜘蛛之类的东西不支持自解压,99.99%的浏览器基本上都支持gzip解压了,所以可以不用设这个值,保持系统默认即可。 gzip_comp_level 2; gzip_comp_level 语法: gzip_comp_level 1..9 默认值: gzip_comp_level 1 作用域: http, server, location gzip压缩比,1 压缩比最小处理速度最快,9 压缩比最大但处理最慢(传输快但比较消耗cpu)。 gzip_types text/plain application/x-javascript text/css application/xml; gzip_types 语法: gzip_types mime-type [mime-type ...] 默认值: gzip_types text/html 作用域: http, server, location 匹配MIME类型进行压缩,(无论是否指定)"text/html"类型总是会被压缩的。 注意:如果作为http server来使用,主配置文件中要包含文件类型配置文件 http { include conf/mime.types; ...... } 如果你希望压缩常规的文件类型,可以写成这个样子 http { : include conf/mime.types; : gzip on; : gzip_min_length 1000; : gzip_buffers 4 8k; : gzip_http_version 1.1; : gzip_types text/plain application/x-javascript text/css text/html application/xml; : ...... } log_format access '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" $http_x_forwarded_for'; 语法: access_log path [format [buffer=size | off ] 默认值: access_log log/access.log combined 作用域: http, server, location 指令 access_log 指派路径、格式和缓存大小。参数 "off" 将清除当前级别的所有 access_log 指令。如果未指定格式,则使用预置的 "combined" 格式。缓存不能大于能写入磁盘的文件的最大大小。在 FreeBSD 3.0-6.0 ,缓存大小无此限制。 语法: log_format name format [format ...] 默认值: log_format combined "..." 作用域: http server Directive log_format describes the format of a log entry. Besides general variables in the format it is possible to use variables which exist only at the moment of record into the log: • $body_bytes_sent, the number of bytes, transmitted to client minus the response headers, variable is compatible with parameter %B of module Apache's mod_log_config (this was called $apache_bytes_sent, before version 0.3.10) • $bytes_sent, the number of bytes, transmitted to client • $connection, the number of connection • $msec, the time with an accuracy to microseconds at the moment of the log entry • $pipe, "p" if request was pipelining • $request_length, the length of the body of the request • $request_time, the time of working on request in seconds • $status, status of answer • $time_local, local time into common log format. The headers, transmitted to client, begin from the prefix "sent_http_", for example, $sent_http_content_range. In the configuration there is always a predetermined format "combined": log_format combined '$remote_addr - $remote_user [$time_local] ' : '"$request" $status $apache_bytes_sent ' : '"$http_referer" "$http_user_agent"'; server { listen 80; server_name www.domain.com domain.com; index index.html index.htm index.php; root /domain/www; location ~ .*\.(php|php5)?$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fcgi.conf; 这个模块允许Nginx 与FastCGI 进程交互,并通过传递参数来控制FastCGI 进程工作。 配置实例: location / { fastcgi_pass localhost:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /home/www/scripts/php$fastcgi_script_name; fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; } } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; expires 语法: expires [time|epoch|max|off] 默认值: expires off 作用域: http, server, location 使用本指令可以控制HTTP应答中的“Expires”和“Cache-Control”的头标,(起到控制页面缓存的作用)。 可以在time值中使用正数或负数。“Expires”头标的值将通过当前系统时间加上您设定的 time 值来获得。 epoch 指定“Expires”的值为 1 January, 1970, 00:00:01 GMT。 max 指定“Expires”的值为 31 December 2037 23:59:59 GMT,“Cache-Control”的值为10年。 -1 指定“Expires”的值为 服务器当前时间 -1s,即永远过期 “Cache-Control”头标的值由您指定的时间来决定: • 负数:Cache-Control: no-cache • 正数或零:Cache-Control: max-age = #, # 为您指定时间的秒数。 "off" 表示不修改“Expires”和“Cache-Control”的值 } location ~ .*\.(js|css)?$ { expires 1h; } error_page 404 = /404.html; access_log /var/log/nginx/www.log access; } } http { include mime.types; default_type application/octet-stream; charset utf-8; server_names_hash_bucket_size 128; client_header_buffer_size 32k; large_client_header_buffers 4 32k; client_max_body_size 300m; sendfile on; tcp_nopush on; keepalive_timeout 60; tcp_nodelay on; client_body_buffer_size 512k; proxy_connect_timeout 5; proxy_connect_timeout 语法: proxy_connect_timeout timeout_in_seconds 上下文: http, server, location 该参数定义了跟代理服务器连接的超时时间,必须留意这个time out时间不能超过75秒. 这并不是服务器开始返回页面的时间(这是proxy_read_timeout的定义).如果upstream服务器在线,但是挂死(比如,它暂时没有足够的进程去处理你的请求,先放在连接池里边等待处理),这时这个参数无法帮助你,因为跟服务器的连接已经建立了. proxy_read_timeout 60; proxy_read_timeout 语法: proxy_read_timeout the_time 默认值: proxy_read_timeout 60 上下文: http, server, location This directive sets the read timeout for the response of the proxied server. It determines how long NGINX will wait to get the response to a request. The timeout is established not for entire response, but only between two operations of reading. In contrast to [#proxy_connect_timeout proxy_connect_timeout] , this timeout will catch a server that puts you in it's connection pool but does not respond to you with anything beyond that. Be careful though not to set this too low, as your proxyserver might take a longer time to respond to requests on purpose (e.g. when serving you a report page that takes some time to compute). You are able though to have a different setting per location, which enables you to have a higher proxy_read_timeout for the report page's location. If the proxied server nothing will communicate after this time, then nginx is shut connection. proxy_send_timeout 5; proxy_send_timeout 语法: proxy_send_timeout time_in_seconds 默认值: proxy_send_timeout 60 上下文: http, server, location This directive assigns timeout with the transfer of request to the proxy server. Time out is established not on entire transfer of request, but only between two operations of record. If after this time the proxy server will not take new data, then nginx is shut the connection proxy_buffer_size 16k; proxy_buffer_size syntax: proxy_buffer_size the_size default: proxy_buffer_size 4k/8k context: http, server, location 该指令设置缓冲区大小,从代理后端服务器取得的第一部分的响应内容,会放到这里. 小的响应header通常位于这部分响应内容里边. 默认来说,该缓冲区大小等于指令 proxy_buffers所设置的;但是,你可以把它设置得更小. proxy_buffers 4 64k; proxy_buffers 语法: proxy_buffers the_number is_size; 默认值: proxy_buffers 8 4k/8k; 上下文: http, server, location 该指令设置缓冲区的大小和数量,从被代理的后端服务器取得的响应内容,会放置到这里. 默认情况下,一个缓冲区的大小等于内存页面大小,可能是4K也可能是8K,这取决于平台 proxy_busy_buffers_size 128k; proxy_busy_buffers_size 语法: proxy_busy_buffers_size size; 默认值: proxy_busy_buffers_size proxy_buffer_size * 2; 上下文: http, server, location, if proxy_temp_file_write_size 128k; proxy_temp_file_write_size 语法: proxy_temp_file_write_size size; 默认值: proxy_temp_file_write_size proxy_buffer_size * 2; 上下文: http, server, location, if gzip on; gzip_min_length 1k; gzip_buffers 4 16k; gzip_http_version 1.1; gzip_comp_level 2; gzip_types text/plain application/x-javascript text/css application/xml; gzip_vary on; proxy_temp_path /proxy_temp_dir; proxy_temp_path syntax: proxy_temp_path dir-path [ level1 [ level2 [ level3 ]; default: $NGX_PREFIX/proxy_temp controlled by --http-proxy-temp-path at ./configure stage context: http, server, location This directive works like client_body_temp_path to specify a location to buffer large proxied requests to the filesystem proxy_cache_path /proxy_cache_dir levels=1:2 keys_zone=cache_one:200m inactive=1d max_size=30g; proxy_cache_path syntax: proxy_cache_path path [levels=number] keys_zone=zone_name:zone_size [inactive=time] [max_size=size]; default: None context: http 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; In this cache, file names will be like the following: /data/nginx/cache/c/29/b7f54b2df7773722d382f4809d65029c You may use any combination of 1 and 2 in the level formats: X, X:X, or X:X:X e.g.: "2", "2:2", "1:1:2". There can be at most 3 levels. All active keys and metadata is stored in shared memory. Zone name and the size of the zone is defined via the keys_zone parameter. Note that each defined zone must have a unique path. For example: 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; 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. upstream fuzaijunheng { server 192.168.1.100:80 weight=10; server 192.168.1.101:80 weight=6; server 192.168.1.102:80 weight=5; } 该模块为后端服务器提供简单的负载均衡(轮循调度和客户端 IP)。 示例: upstream backend { server backend1.example.com weight=5; server backend2.example.com:8080; server unix:/tmp/backend3; } server { location / { proxy_pass http://backend; } } 语法: ip_hash 默认值: 无 语境: upstream This directive causes requests to be distributed between upstreams based on the IP-address of the client. The key for the hash is the class-C network address of the client. This method guarantees that the client request will always be transferred to the same server. But if this server is considered inoperative, then the request of this client will be transferred to another server. This gives a high probability clients will always connect to the same server. It is not possible to combine ip_hash and weight methods for connection distribution. If one of the servers must be removed for some time, you must mark that server as *down*. 示例: upstream backend { ip_hash; server backend1.example.com; server backend2.example.com; server backend3.example.com down; server backend4.example.com; } server 语法: server name [parameters] 默认值: 无 语境: upstream Directive assigns the name and the parameters of server. For the name it is possible to use a domain name, an address, port or unix socket. If domain name resolves to several addresses, then all are used. • weight = NUMBER - set weight of the server, if not set weight is equal to one. • max_fails = NUMBER - number of unsuccessful attempts at communicating with the server within the time period (assigned by parameter fail_timeout) after which it is considered inoperative. If not set, the number of attempts is one. A value of 0 turns off this check. What is considered a failure is defined by proxy_next_upstream or fastcgi_next_upstream (except http_404 errors which do not count towards max_fails). • fail_timeout = TIME - the time during which must occur *max_fails* number of unsuccessful attempts at communication with the server that would cause the server to be considered inoperative, and also the time for which the server will be considered inoperative (before another attempt is made). If not set the time is 10 seconds. fail_timeout has nothing to do with upstream response time, use proxy_connect_timeout and proxy_read_timeout for controlling this. • down - marks server as permanently offline, to be used with the directive ip_hash. • backup - (0.6.7 or later) only uses this server if the non-backup servers are all down or busy 示例: upstream backend { server backend1.example.com weight=5; server 127.0.0.1:8080 max_fails=3 fail_timeout=30s; server unix:/tmp/backend3; } upstream 语法: upstream name { ... } 默认值: 无 语境: http 这个指令描述了一个服务器的集合,该集合可被用于 proxy_pass 和 fastcgi_pass 指令中,作为一个单独的实体。 这些服务器可以是监听在不同的端口,另外,并发使用同时监听 TCP 端口和 Unix 套接字的服务器是可能的。 这些服务器能被分配不同的权重。如果没有指定,则都为一。 示例: upstream backend { server backend1.example.com weight=5; server 127.0.0.1:8080 max_fails=3 fail_timeout=30s; server unix:/tmp/backend3; } Requests are distributed according to the servers in round-robin manner with respect of the server weight. For example of every 7 seven requests given above they will be distributed like this: 5 requests on backend1.example.com and one request to the second and the third of server. If with an attempt at the work with the server error occurred, then the request will be transmitted to the following server and then until all workers of server not are tested. If successful answer is not succeeded in obtaining from all servers, then to client will be returned the result of work with the last server. upstream admin_server { server 192.168.1.100:80; } server { listen 80; server_name zzy.domain.com; index index.html index.htm; location / { proxy_next_upstream http_502 http_504 error timeout invalid_header; proxy_next_upstream syntax: proxy_next_upstream [error|timeout|invalid_header|http_500|http_502|http_503|http_504|http_404|off]; default: proxy_next_upstream error timeout; context: http, server, location 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_cache cache_one; proxy_cache syntax: proxy_cache zone_name; default: None context: http, server, location This directive sets name of zone for caching. The same zone can be used in multiple places. The cache honors backend's "Expires", "Cache-Control: no-cache", and "Cache-Control: max-age=XXX" headers since version 0.7.48. Since version 7.66, "private" and "no-store" are also honored. nginx does not handle "Vary" headers when caching. In order to ensure private items are not served to all users unintentionally by the cache, the back-end can set "no-cache" or "max-age=0", or the proxy_cache_key must include user-specific data such as $cookie_xxx. However, using cookie values as part of proxy_cache_key can defeat the benefits of caching for public items, so separate locations with different proxy_cache_key values might be necessary to separate private and public items. The cache depends on proxy buffers, and will not work if proxy_buffers is set to off. The following response headers flag a response as uncacheable unless they are ignored: • Set-Cookie • Cache-Control containing "no-cache", "no-store", "private", or a "max-age" with a non-numeric or 0 value • Expires with a time in the past • X-Accel-Expires: 0 proxy_cache_valid 200 304 12h; proxy_cache_valid syntax: proxy_cache_valid reply_code [reply_code ...] time; default: None context: http, server, location This directive sets the time for caching different replies. Example: proxy_cache_valid 200 302 10m; proxy_cache_valid 404 1m; 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; 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 200 302 10m; proxy_cache_valid 301 1h; proxy_cache_valid any 1m; Upstream cache-related directives have priority over proxy_cache_valid value, in particular the order is (from Igor): 1. X-Accel-Expires 2. Expires/Cache-Control 3. 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; 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_cache_key $host$uri$is_args$args; proxy_cache_key syntax: proxy_cache_key line; default: $scheme$proxy_host$request_uri; context: http, server, location The directive specifies what information is included in the key for caching, for example proxy_cache_key "$host$request_uri$cookie_user"; Note that by default, the hostname of the server is not included in the cache key. If you are using subdomains for different locations on your website, you need to include it, e.g. by changing the cache key to something like proxy_cache_key "$scheme$host$request_uri"; proxy_set_header Host $host; proxy_set_header 语法: proxy_set_header header value 默认值: Host and Connection 上下文: http, server, location This directive allows to redefine and to add some request header lines which will be transferred to the proxied server. As the value it is possible to use a text, variables and their combination. This directive is inherited from the previous level when at this level are not described their directives proxy_set_header. By default only two lines will be redefined: proxy_set_header Host $proxy_host; proxy_set_header Connection Close; The unchanged request-header "Host" can be transmitted like this: proxy_set_header Host $http_host; However, if this line is absent from the client request, then nothing will be transferred. In this case it is better to use variable $host, it's value is equal to the name of server in the request-header "Host" or to the basic name of server, if there is no line: proxy_set_header Host $host; Furthermore, it is possible to transmit the name of server together with the port of the proxied server: proxy_set_header Host $host:$proxy_port; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_pass http://fuzaijunheng; expires 1d; } location ~ /purge(/.*) { allow 192.168.1.0/24; deny all; proxy_cache_purge cache_one $host$1$is_args$args; ngx_cache_purge 本模块由第三方提供,不包含在 Nginx 的源码发布版中。 ngx_cache_purge is nginx module which adds ability to purge content from FastCGI, proxy, SCGI and uWSGI caches. 下载模块源码:ngx_cache_purge-1.2(更新记录) (SHA1: d9468cf42432e81ea3a110ec63aae2eb273f5516) 解压,然后编译: ./configure make && make install 配置指令 fastcgi_cache_purge zone_name key (context: location) Sets area and key used for purging selected pages from FastCGI's cache. proxy_cache_purge zone_name key (context: location) Sets area and key used for purging selected pages from proxy's cache. scgi_cache_purge zone_name key (context: location) Sets area and key used for purging selected pages from SCGI's cache. uwsgi_cache_purge zone_name key (context: location) Sets area and key used for purging selected pages from uWSGI's cache. 示例配置 http { proxy_cache_path /tmp/cache keys_zone=tmpcache:10m; server { location / { proxy_pass http://127.0.0.1:8000; proxy_cache tmpcache; proxy_cache_key $uri$is_args$args; } location ~ /purge(/.*) { allow 127.0.0.1; deny all; proxy_cache_purge tmpcache $1$is_args$args; } } } } if ( $request_method = "PURGE" ) { rewrite ^(.*)$ /purge$1 last; } location ~ /e/admin(/.*) { proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr; proxy_pass http://admin_server; } location ~ .*\.(php|jsp|cgi)?$ { proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr; proxy_pass http://fuzaijunheng; } location ~ .*\?.*$ { proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr; proxy_pass http://fuzaijunheng; } log_format access1 '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" $http_x_forwarded_for'; access_log /var/log/nginx/cscache.log access1; } }
我和谁都不争,和谁争我都不屑,我爱大自然,其次就是艺术,我双手烤着生命之火取暖,火萎了,我也准备走了。
浙公网安备 33010602011771号