zer0bin/example.nginx

73 lines
1.7 KiB
Nginx Configuration File
Executable File

# replace example.tld with your domain
# replace /location/to with the parent folder of zer0bin
server {
#listen 80 is default
server_name www.example.tld;
return 301 https://example.tld$request_uri;
}
server {
listen 80;
server_name example.tld;
root /location/to/zer0bin/frontend/dist;
rewrite ^/~/(.*)$ /index.html;
location / {
index index.html;
}
location ~ \.(css|js|html) {
try_files $uri =404;
}
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;
}
}
server {
listen 443;
server_name example.tld;
root /location/to/zer0bin/frontend/dist;
rewrite ^/~/(.*)$ /index.html;
location / {
index index.html;
}
location ~ \.(css|js|html) {
try_files $uri =404;
}
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;
}
# If you have letsencrypt certs provided by certbot:
# ssl_certificate /etc/letsencrypt/live/example.tld/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/example.tld/privkey.pem;
}