1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| server { listen 80; server_name 域名; rewrite ^(.*)$ https://$host$request_uri permanent; } server { listen 443 ssl http2; server_name 域名; location / { proxy_pass http://******.github.io; proxy_set_header X-Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header User-Agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36"; #缓存 proxy_cache_valid 200 206 304 301 302 1d; #对httpcode为200…的缓存1天 proxy_cache_valid any 1d; #其他的缓存多长时间 proxy_cache_key $uri; #定义缓存唯一key,通过唯一key来进行hash存取 } access_log off; #access_log end error_log off; #error_log end }
|