直接贴上nginx.conf
#cache begin proxy_buffering on; proxy_cache_valid any 10m; proxy_cache_path /data/nginx/cache levels=1:2 keys_zone=nginxcache:8m max_size=10g inactive=30d; proxy_temp_path /data/nginx/temp; proxy_buffer_size 4k; proxy_buffers 100 8k; #cache end server { listen 80 default_server; listen [::]:80 default_server; server_name tixbay.net; root /data/nginx/www; # Load configuration files for the default server block. include /etc/nginx/default.d/*.conf; location ~ .*\.(jpg|jpeg|png|gif|js|css)?$ { #一般只缓存静态资源 proxy_cache nginxcache; #与keys_zone对应 proxy_cache_valid 200 206 304 301 302 10d; proxy_cache_key $scheme$uri$is_args$args; #缓存key proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header REMOTE-HOST $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; client_max_body_size 100m; proxy_pass http://tunnelhome; } location / { #其他默认处理 proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header REMOTE-HOST $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; client_max_body_size 100m; proxy_pass http://tunnelhome; } }
0 条评论。