Fix nginx config for local federation setup

This commit is contained in:
Felix Ableitner 2020-09-21 14:56:55 +02:00
parent aece5e67b7
commit b573199765
2 changed files with 71 additions and 15 deletions

View file

@ -16,6 +16,7 @@ services:
- pictrs
- iframely
- lemmy-alpha
- lemmy-alpha-ui
- lemmy-beta
- lemmy-gamma
- lemmy-delta

View file

@ -3,6 +3,12 @@ events {
}
http {
upstream lemmy-alpha {
server "lemmy-alpha:8541";
}
upstream lemmy-alpha-ui {
server "lemmy-alpha-ui:1234";
}
server {
listen 8540;
server_name 127.0.0.1;
@ -11,14 +17,19 @@ http {
# Upload limit for pictshare
client_max_body_size 50M;
location /api/v1 {
proxy_pass http://lemmy-alpha:8541/api/v1;
location ~ ^/(api|docs|pictrs|feeds|nodeinfo|.well-known) {
proxy_pass http://lemmy-alpha;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location / {
proxy_pass http://lemmy-alpha-ui:1234;
set $proxpass http://lemmy-alpha-ui;
if ($http_accept = "application/activity+json") {
set $proxpass http://lemmy-alpha;
}
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;
@ -34,6 +45,12 @@ http {
}
}
upstream lemmy-beta {
server "lemmy-beta:8551";
}
upstream lemmy-beta-ui {
server "lemmy-beta-ui:1234";
}
server {
listen 8550;
server_name 127.0.0.1;
@ -42,14 +59,19 @@ http {
# Upload limit for pictshare
client_max_body_size 50M;
location /api/v1 {
proxy_pass http://lemmy-beta:8551/api/v1;
location ~ ^/(api|docs|pictrs|feeds|nodeinfo|.well-known) {
proxy_pass http://lemmy-beta;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location / {
proxy_pass http://lemmy-beta-ui:1234;
set $proxpass http://lemmy-beta-ui;
if ($http_accept = "application/activity+json") {
set $proxpass http://lemmy-beta;
}
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;
@ -65,6 +87,12 @@ http {
}
}
upstream lemmy-gamma {
server "lemmy-gamma:8561";
}
upstream lemmy-gamma-ui {
server "lemmy-gamma-ui:1234";
}
server {
listen 8560;
server_name 127.0.0.1;
@ -73,14 +101,19 @@ http {
# Upload limit for pictshare
client_max_body_size 50M;
location /api/v1 {
proxy_pass http://lemmy-gamma:8561/api/v1;
location ~ ^/(api|docs|pictrs|feeds|nodeinfo|.well-known) {
proxy_pass http://lemmy-gamma;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location / {
proxy_pass http://lemmy-gamma-ui:1234;
set $proxpass http://lemmy-gamma-ui;
if ($http_accept = "application/activity+json") {
set $proxpass http://lemmy-gamma;
}
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;
@ -96,6 +129,12 @@ http {
}
}
upstream lemmy-delta {
server "lemmy-delta:8571";
}
upstream lemmy-delta-ui {
server "lemmy-delta-ui:1234";
}
server {
listen 8570;
server_name 127.0.0.1;
@ -104,14 +143,19 @@ http {
# Upload limit for pictshare
client_max_body_size 50M;
location /api/v1 {
proxy_pass http://lemmy-delta:8571/api/v1;
location ~ ^/(api|docs|pictrs|feeds|nodeinfo|.well-known) {
proxy_pass http://lemmy-delta;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location / {
proxy_pass http://lemmy-delta-ui:1234;
set $proxpass http://lemmy-delta-ui;
if ($http_accept = "application/activity+json") {
set $proxpass http://lemmy-delta;
}
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;
@ -127,6 +171,12 @@ http {
}
}
upstream lemmy-epsilon {
server "lemmy-epsilon:8581";
}
upstream lemmy-epsilon-ui {
server "lemmy-epsilon-ui:1234";
}
server {
listen 8580;
server_name 127.0.0.1;
@ -135,14 +185,19 @@ http {
# Upload limit for pictshare
client_max_body_size 50M;
location /api/v1 {
proxy_pass http://lemmy-epsilon:8581/api/v1;
location ~ ^/(api|docs|pictrs|feeds|nodeinfo|.well-known) {
proxy_pass http://lemmy-epsilon;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location / {
proxy_pass http://lemmy-epsilon-ui:1234;
set $proxpass http://lemmy-epsilon-ui;
if ($http_accept = "application/activity+json") {
set $proxpass http://lemmy-epsilon;
}
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;