zer0bin/example.nginx

46 lines
1.2 KiB
Plaintext
Raw 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-16 07:13:54 +00:00
# uncomment the `brotli on;` lines if you have the nginx brotoli plugin
2022-03-16 05:44:02 +00:00
# uncomment the `ssl_certificate` lines 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;
# 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;
}
location ~ \.(css|js|html) {
try_files $uri =404;
}
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-13 21:48:40 +00:00
2022-03-16 05:32:43 +00:00
expires 30d;
add_header Cache-Control "public, no-transform";
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;
}