-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnginx.conf
More file actions
93 lines (79 loc) · 2.83 KB
/
nginx.conf
File metadata and controls
93 lines (79 loc) · 2.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
worker_processes 1;
pid /run/nginx.pid;
error_log stderr warn;
events {
worker_connections 256;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /dev/stdout;
# Temp paths in writable directory
client_body_temp_path /run/nginx-client-body;
proxy_temp_path /run/nginx-proxy;
fastcgi_temp_path /run/nginx-fastcgi;
uwsgi_temp_path /run/nginx-uwsgi;
scgi_temp_path /run/nginx-scgi;
upstream sveltekit {
server 127.0.0.1:3000;
}
upstream botkit {
server 127.0.0.1:8001;
}
server {
listen 8000;
server_name _;
client_max_body_size 10m;
# ActivityPub / WebFinger endpoints → Botkit
location /.well-known/webfinger {
proxy_pass http://botkit;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
}
location /.well-known/nodeinfo {
proxy_pass http://botkit;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
}
# Bot actor — redirect browsers to homepage, proxy AP clients to Botkit
location /ap/ {
# If browser (accepts text/html but not activity+json), redirect to homepage
if ($http_accept ~* "text/html" ) {
set $maybe_redirect "html";
}
if ($http_accept !~* "application/activity\+json|application/ld\+json") {
set $maybe_redirect "${maybe_redirect}_noap";
}
if ($maybe_redirect = "html_noap") {
return 302 https://$host/about;
}
proxy_pass http://botkit;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
}
location /users/ {
proxy_pass http://botkit;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
}
# NodeInfo
location /nodeinfo/ {
proxy_pass http://botkit;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
}
# Everything else → SvelteKit
location / {
proxy_pass http://sveltekit;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Host $host;
}
}
}