-
Notifications
You must be signed in to change notification settings - Fork 2
/
example.nginx
executable file
·53 lines (43 loc) · 1.48 KB
/
example.nginx
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
# replace `example.tld` with your domain
# replace `/location/of/zer0bin` with the location of the zer0bin folder
# comment out line 15 and uncomment line 16 if you have the nginx brotoli plugin
# uncomment lines 51 and 52 if you have letsencrypt certs
server {
server_name example.tld;
return 301 https://example.tld$request_uri;
}
server {
listen 443;
server_name example.tld;
gzip_static on;
# brotli on;
root /location/of/zer0bin/frontend/dist;
rewrite ^/(?!.*api)(?!.*\.).*$ /index.html;
location / {
index index.html;
expires 30d;
add_header Cache-Control "public, no-transform";
}
location ~ \.(css|js|html) {
try_files $uri =404;
expires 30d;
add_header Cache-Control "public, no-transform";
}
location ^~ /.well-known/ {
alias /var/www/.well-known/;
}
location /api/ {
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Origin' '*';
proxy_pass http://localhost:8000/;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
add_header Last-Modified $date_gmt;
add_header Cache-Control 'no-store, no-cache';
if_modified_since off;
expires off;
etag off;
}
# ssl_certificate /etc/letsencrypt/live/example.tld/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/example.tld/privkey.pem;
}