events { worker_connections 1024; } http { upstream lemmy { server "lemmy:8541"; } upstream lemmy-ui { server "lemmy-ui:1234"; } server { listen 8540; server_name 127.0.0.1; access_log off; # Upload limit for pictshare client_max_body_size 50M; location ~ ^/(api|pictrs|feeds|nodeinfo|.well-known) { proxy_pass http://lemmy; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } location / { set $proxpass http://lemmy-ui; if ($http_accept = "application/activity+json") { set $proxpass http://lemmy; } if ($http_accept = "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"") { set $proxpass http://lemmy; } proxy_pass $proxpass; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # Cuts off the trailing slash on URLs to make them valid rewrite ^(.+)/+$ $1 permanent; } } }