| 1 | user nginx;
|
|---|
| 2 | worker_processes auto;
|
|---|
| 3 | error_log /dev/stdout info;
|
|---|
| 4 | pid /var/run/nginx.pid;
|
|---|
| 5 | events {
|
|---|
| 6 | worker_connections 1024;
|
|---|
| 7 | }
|
|---|
| 8 | daemon off;
|
|---|
| 9 | http {
|
|---|
| 10 | include /etc/nginx/mime.types;
|
|---|
| 11 | default_type application/octet-stream;
|
|---|
| 12 | log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
|---|
| 13 | '$status $body_bytes_sent "$http_referer" '
|
|---|
| 14 | '"$http_user_agent" "$http_x_forwarded_for"';
|
|---|
| 15 | access_log /dev/stdout;
|
|---|
| 16 | sendfile on;
|
|---|
| 17 | keepalive_timeout 65;
|
|---|
| 18 | proxy_cache_path /tmp/nginx-cache levels=1:2 keys_zone=static-cache:200m max_size=45g inactive=60m use_temp_path=off;
|
|---|
| 19 | proxy_cache_key "$scheme$host$request_uri";
|
|---|
| 20 |
|
|---|
| 21 | map $upstream_http_content_length $no_cache {
|
|---|
| 22 | default 1;
|
|---|
| 23 | "~^[0-9]{1,6}$" 0;
|
|---|
| 24 | }
|
|---|
| 25 |
|
|---|
| 26 | server {
|
|---|
| 27 | listen 80 default_server;
|
|---|
| 28 | server_name _;
|
|---|
| 29 | location / {
|
|---|
| 30 | proxy_set_header Host "docs.nginx.com";
|
|---|
| 31 | proxy_cache static-cache;
|
|---|
| 32 | proxy_ignore_headers Cache-Control;
|
|---|
| 33 | add_header X-Cache-Status $upstream_cache_status;
|
|---|
| 34 | set $proxy_cache_key $scheme$proxy_host$uri$is_args$args;
|
|---|
| 35 | proxy_cache_valid 5d;
|
|---|
| 36 | proxy_no_cache $no_cache;
|
|---|
| 37 | # if you uncomment the line below it makes $no_cache = 1
|
|---|
| 38 | # proxy_cache_bypass $no_cache;
|
|---|
| 39 | add_header X-No-Cache $no_cache;
|
|---|
| 40 | proxy_pass https://docs.nginx.com:443;
|
|---|
| 41 | }
|
|---|
| 42 | }
|
|---|
| 43 | }
|
|---|
| 44 |
|
|---|
| 45 |
|
|---|
| 46 | #checkout: curl -I -s http://127.0.0.1/images/icons/NGINX-Docs-horiz-white-type.svg | grep X-
|
|---|