mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-09-09 16:08:49 -06:00
52 lines
1.4 KiB
Nginx Configuration File
52 lines
1.4 KiB
Nginx Configuration File
![]() |
worker_processes 1;
|
||
|
events {
|
||
|
worker_connections 1024;
|
||
|
}
|
||
|
http {
|
||
|
upstream lemmy {
|
||
|
server "lemmy:8536";
|
||
|
}
|
||
|
upstream lemmy-ui {
|
||
|
server "lemmy-ui:1234";
|
||
|
}
|
||
|
server {
|
||
|
listen 1236;
|
||
|
server_name localhost;
|
||
|
|
||
|
# frontend
|
||
|
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";
|
||
|
}
|
||
|
if ($request_method = POST) {
|
||
|
set $proxpass "http://lemmy";
|
||
|
}
|
||
|
proxy_pass $proxpass;
|
||
|
|
||
|
rewrite ^(.+)/+$ $1 permanent;
|
||
|
|
||
|
# Send actual client IP upstream
|
||
|
proxy_set_header X-Real-IP $remote_addr;
|
||
|
proxy_set_header Host $host;
|
||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
|
}
|
||
|
|
||
|
# backend
|
||
|
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";
|
||
|
|
||
|
# Add IP forwarding headers
|
||
|
proxy_set_header X-Real-IP $remote_addr;
|
||
|
proxy_set_header Host $host;
|
||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
|
}
|
||
|
}
|
||
|
}
|