-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnginx.conf
More file actions
31 lines (27 loc) · 932 Bytes
/
nginx.conf
File metadata and controls
31 lines (27 loc) · 932 Bytes
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
events {
# We need an events context to avoid an error on startup, but we don't need to put
# anything inside for our simple use case.
}
http {
server {
listen 127.0.0.1:8000;
# The new server that I'm gradually phasing in.
location /api2/ {
proxy_pass http://localhost:3001;
}
# Proxying for the NextJS websocket, to allow hot reloading, etc. This is all
# just magic copied from https://nginx.org/en/docs/http/websocket.html.
location /_next/ {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
}
# Because both the old server (under /api) and all web pages are being served at
# localhost:3000, I don't have to specify a special location for the old server.
location / {
proxy_pass http://localhost:3000;
}
}
}