Advertisement
TheTrickster

Liizzii's bodge cache for dynmap

Feb 6th, 2021 (edited)
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 2.35 KB | None | 0 0
  1. worker_processes  2;
  2. # Can maybe bump the above to 4, but didn't observe any noticable speed bump in my 1 user setup
  3.  
  4. events {
  5.     worker_connections  1024;
  6. }
  7.  
  8.  
  9. http {
  10.   include       mime.types;
  11.   default_type  application/octet-stream;
  12.   log_format verb '$remote_addr $host $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" rt=$request_time gr=$gzip_ratio h2="$http2" cache="$upstream_cache_status"';
  13.   access_log /var/log/nginx/access.log verb;
  14.   sendfile        on;
  15.   tcp_nopush     on;
  16.   keepalive_timeout  65;
  17.  
  18.   gzip  on;
  19.   proxy_cache_path /tmp/dynmapcache levels=1:2 keys_zone=dynmapcache:5m inactive=1h max_size=1g use_temp_path=off;
  20.   proxy_cache_key $scheme$proxy_host$http_host$request_uri;
  21.   proxy_http_version 1.1;
  22.  
  23.   map $sent_http_content_type $expires {
  24.     default -1;
  25.     ~image/ 10m;
  26.   }
  27.   server {
  28.     listen       80;
  29.     listen  [::]:80;
  30.     server_name  _;
  31.  
  32.         location / {
  33.                 proxy_cache dynmapcache;
  34.                 proxy_set_header Host exalted.asuscomm.com;
  35.                 proxy_cache_background_update on;
  36.                 #proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
  37.                 proxy_connect_timeout 20s;
  38. #               proxy_cache_valid 200 1s;
  39.                 proxy_cache_revalidate on;
  40.                 proxy_socket_keepalive on;
  41.                 proxy_pass http://exalted.asuscomm.com:8123;
  42.                 proxy_ignore_headers X-Accel-Expires;
  43.                 proxy_ignore_headers Expires;
  44.                 proxy_ignore_headers Cache-Control;
  45.                 expires $expires;
  46.         }
  47.         location /tiles {
  48.                 proxy_cache dynmapcache;
  49.                 proxy_set_header Host exalted.asuscomm.com;
  50.                 proxy_cache_background_update on;
  51.                 proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
  52.                 proxy_connect_timeout 20s;
  53.                 proxy_cache_valid 200 10m;
  54.                 proxy_cache_revalidate on;
  55.                 proxy_socket_keepalive on;
  56.                 proxy_pass http://exalted.asuscomm.com:8123;
  57.                 proxy_ignore_headers X-Accel-Expires;
  58.                 proxy_ignore_headers Expires;
  59.                 proxy_ignore_headers Cache-Control;
  60.  
  61.         }
  62.  
  63.   }
  64. }
  65.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement