zer0bin/example.nginx

69 lines
1.4 KiB
Plaintext
Raw Normal View History

2022-03-01 00:17:29 +00:00
# replace example.tld with your domain
2022-03-01 00:48:20 +00:00
# replace /location/to with the location
2022-03-01 00:17:29 +00:00
server {
#listen 80 is default
server_name www.example.tld;
return 301 $scheme://example.tld$request_uri;
}
server {
listen 80;
2022-03-13 21:48:40 +00:00
server_name example.tld;
2022-03-05 01:28:39 +00:00
root /location/to/zer0bin/frontend/dist;
2022-03-13 21:48:40 +00:00
rewrite ^/~/(.*)$ /index.html;
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-01 00:17:29 +00:00
}
server {
2022-03-13 21:48:40 +00:00
listen 443;
server_name example.tld;
2022-03-05 01:28:39 +00:00
root /location/to/zer0bin/frontend/dist;
2022-03-13 21:48:40 +00:00
rewrite ^/~/(.*)$ /index.html;
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-01 00:17:29 +00:00
}