-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnginx.conf
More file actions
55 lines (46 loc) · 1.43 KB
/
nginx.conf
File metadata and controls
55 lines (46 loc) · 1.43 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
worker_processes 1;
error_log /dev/stderr;
pid /tmp/nginx.pid;
events {
worker_connections 128;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /dev/stdout;
# Use temp paths so nginx can run without root
client_body_temp_path /tmp/nginx_client_body;
proxy_temp_path /tmp/nginx_proxy;
fastcgi_temp_path /tmp/nginx_fastcgi;
uwsgi_temp_path /tmp/nginx_uwsgi;
scgi_temp_path /tmp/nginx_scgi;
server {
listen ${PORT};
server_name localhost;
root dist;
index index.html;
# Inject live-reload SSE script before </body>
sub_filter '</body>' '<script>new EventSource("/sse").onmessage=()=>location.reload()</script></body>';
sub_filter_once on;
sub_filter_types text/html;
# Proxy SSE endpoint to rollup live-reload server
location = /sse {
proxy_pass http://127.0.0.1:35729;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_buffering off;
proxy_cache off;
}
# Serve static files; fall back to index.html for SPA routing
location / {
try_files $uri $uri/ /index.html;
}
# Cache-bust assets
location /assets/ {
expires 1y;
add_header Cache-Control "public, immutable";
}
# Custom 404
error_page 404 /404.html;
}
}