zer0bin/example.nginx

54 lines
1.5 KiB
Plaintext
Raw Permalink Normal View History

2022-03-16 05:44:02 +00:00
# replace `example.tld` with your domain
2022-03-16 05:44:32 +00:00
# replace `/location/of/zer0bin` with the location of the zer0bin folder
2022-03-23 22:44:16 +00:00
# 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
2022-03-01 00:17:29 +00:00
server {
server_name example.tld;
2022-03-13 22:37:16 +00:00
return 301 https://example.tld$request_uri;
2022-03-01 00:17:29 +00:00
}
server {
2022-03-16 05:20:44 +00:00
listen 443;
2022-03-13 21:48:40 +00:00
server_name example.tld;
2022-03-23 22:44:16 +00:00
gzip_static on;
# brotli on;
2022-03-13 21:48:40 +00:00
2022-03-16 05:20:44 +00:00
root /location/of/zer0bin/frontend/dist;
2022-03-13 21:48:40 +00:00
2022-03-20 00:36:33 +00:00
rewrite ^/(?!.*api)(?!.*\.).*$ /index.html;
2022-03-13 21:48:40 +00:00
location / {
index index.html;
2022-03-24 01:36:56 +00:00
expires 30d;
add_header Cache-Control "public, no-transform";
2022-03-13 21:48:40 +00:00
}
location ~ \.(css|js|html) {
try_files $uri =404;
2022-03-24 01:36:56 +00:00
expires 30d;
add_header Cache-Control "public, no-transform";
2022-03-13 21:48:40 +00:00
}
2022-03-01 00:17:29 +00:00
location ^~ /.well-known/ {
alias /var/www/.well-known/;
2022-03-13 21:48:40 +00:00
}
location /api/ {
2022-03-01 00:17:29 +00:00
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;
2022-03-23 19:14:15 +00:00
add_header Last-Modified $date_gmt;
add_header Cache-Control 'no-store, no-cache';
if_modified_since off;
expires off;
etag off;
2022-03-01 00:17:29 +00:00
}
2022-03-13 21:48:40 +00:00
2022-03-16 05:32:43 +00:00
# ssl_certificate /etc/letsencrypt/live/example.tld/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/example.tld/privkey.pem;
}