-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathserver.conf
67 lines (59 loc) · 2.13 KB
/
server.conf
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
server {
listen 0.0.0.0:8000;
server_name my-server;
# Redirect the root URL to your server.
location = / {
return 301 /app;
}
# Known HTTP Entrypoints
# Redirect to the actual server (ex. NodeJS listening on localhost:5000).
location = /app {
include /etc/nginx/conf.d/server-proxy.conf;
proxy_pass http://localhost:5000;
}
location ~ /app/api/v1/? {
include /etc/nginx/conf.d/server-proxy.conf;
proxy_pass http://localhost:5000;
}
# Known WebSocket Entrypoints
# Redirect to the actual server (ex. SocketIO listening on localhost:3000)
location = /app/ws/v1 {
include /etc/nginx/conf.d/server-proxy.conf;
# By default, Socket.IO will set the transport type to 'polling' to support
# browsers that do not support web sockets. If there is already a working
# connection, try to upgrade the client to a 'websocket'.
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://localhost:3000/app/ws/v1;
}
# Static Content/Resources
location ^~ /favicon.ico {
alias /path/to/server/public/favicon.ico;
expires max;
}
location ^~ /assets {
alias /path/to/server/public/assets;
expires max;
}
location ^~ /css {
alias /path/to/server/public/css;
expires max;
}
location ^~ /js {
alias /path/to/server/public/js;
expires max;
}
# Static Content/Resources with no caching
# For example, you are regularly sending images to the browser,
# and you want to tell the browser to NOT cache the last image
# it downloaded.
location ^~ /output {
alias /path/to/output;
add_header Last-Modified $date_gmt;
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
if_modified_since off;
expires off;
etag off;
}
}