diff --git a/common/akkoma.conf b/common/akkoma.conf new file mode 100644 index 0000000..2e4202d --- /dev/null +++ b/common/akkoma.conf @@ -0,0 +1,24 @@ +client_max_body_size 16m; +ignore_invalid_headers off; +proxy_http_version 1.1; +proxy_set_header Upgrade $http_upgrade; +proxy_set_header Connection "upgrade"; +proxy_set_header Host $http_host; +proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + +location / { + proxy_pass http://phoenix; +} + +location ~ ^/(media|proxy) { + proxy_cache akkoma_media_cache; + slice 1m; + proxy_cache_key $host$uri$is_args$args$slice_range; + proxy_set_header Range $slice_range; + proxy_cache_valid 200 206 301 304 1h; + proxy_cache_lock on; + proxy_ignore_client_abort on; + proxy_buffering on; + chunked_transfer_encoding on; + proxy_pass http://phoenix; +} diff --git a/conf.d/akkoma.conf b/conf.d/akkoma.conf new file mode 100644 index 0000000..465330a --- /dev/null +++ b/conf.d/akkoma.conf @@ -0,0 +1,30 @@ +proxy_cache_path /tmp/akkoma-media-cache levels=1:2 keys_zone=akkoma_media_cache:10m max_size=10g inactive=720m use_temp_path=off; +upstream phoenix { + server 127.0.0.1:4001 max_fails=5 fail_timeout=60s; +} +ssl_session_cache shared:ssl_session_cache:10m; +server { + listen 80; + listen [::]:80; + server_name ak.vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion; + include common/akkoma.conf; +} +server { + listen 11089; + listen [::]:11089; + server_name vern2c3ryms73cqnxr3plef2npbwlg5mx75wigd3fve32m5iszya.b32.i2p; + include common/akkoma.conf; +} +server { + listen 443 ssl http2; + listen [::]:443 ssl http2; + server_name ak.vern.cc; + include snippets/lets-encrypt.conf; + include common/akkoma.conf; +} +server { + listen 80; + listen [::]:80; + server_name ak.vern.cc; + return 301 https://$host$request_uri; +}