3 worker_connections 1024;
7 # this needs to map to the lemmy (server) docker service hostname
11 # this needs to map to the lemmy-ui docker service hostname
12 server "lemmy-ui:1234";
16 # this is the port inside docker, not the public one yet
19 # change if needed, this is facing the public web
20 server_name localhost;
24 gzip_types text/css application/javascript image/svg+xml;
27 # Upload limit, relevant for pictrs
28 client_max_body_size 20M;
30 add_header X-Frame-Options SAMEORIGIN;
31 add_header X-Content-Type-Options nosniff;
32 add_header X-XSS-Protection "1; mode=block";
34 # frontend general requests
36 # distinguish between ui requests and backend
37 # don't change lemmy-ui or lemmy here, they refer to the upstream definitions on top
38 set $proxpass "http://lemmy-ui";
40 if ($http_accept = "application/activity+json") {
41 set $proxpass "http://lemmy";
43 if ($http_accept = "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"") {
44 set $proxpass "http://lemmy";
46 if ($request_method = POST) {
47 set $proxpass "http://lemmy";
51 rewrite ^(.+)/+$ $1 permanent;
52 # Send actual client IP upstream
53 proxy_set_header X-Real-IP $remote_addr;
54 proxy_set_header Host $host;
55 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
59 location ~ ^/(api|pictrs|feeds|nodeinfo|.well-known) {
60 proxy_pass "http://lemmy";
62 proxy_http_version 1.1;
63 proxy_set_header Upgrade $http_upgrade;
64 proxy_set_header Connection "upgrade";
66 # Send actual client IP upstream
67 proxy_set_header X-Real-IP $remote_addr;
68 proxy_set_header Host $host;
69 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;