73 lines
2.2 KiB
Plaintext
73 lines
2.2 KiB
Plaintext
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
server_name domain.tld;
|
|
access_log off;
|
|
root /srv/http/domain.tld/dist/chat;
|
|
include /etc/nginx/acme.conf;
|
|
location / {
|
|
return 301 https://domain.tld$request_uri;
|
|
}
|
|
}
|
|
|
|
include dumpdom.conf;
|
|
|
|
server {
|
|
listen 443 ssl http2;
|
|
listen [::]:443 ssl http2;
|
|
server_name domain.tld;
|
|
|
|
ssl_certificate /etc/letsencrypt/live/domain.tld/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/domain.tld/privkey.pem;
|
|
|
|
access_log /var/log/nginx/domain.tld.access.log;
|
|
error_log /var/log/nginx/domain.tld.error.log;
|
|
root /srv/http/domain.tld/dist/appname;
|
|
|
|
proxy_intercept_errors on;
|
|
error_page 500 502 503 504 =200 /index.html;
|
|
error_page 404 =200 /index.html;
|
|
|
|
# example route for backend
|
|
location /files/ {
|
|
proxy_pass http://localhost:9191;
|
|
proxy_read_timeout 10;
|
|
proxy_connect_timeout 10;
|
|
proxy_redirect off;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_intercept_errors off;
|
|
}
|
|
|
|
# example route for backend
|
|
location ~ /api/v1/.* {
|
|
include cors.conf;
|
|
proxy_pass http://localhost:9191;
|
|
proxy_read_timeout 10;
|
|
proxy_connect_timeout 10;
|
|
proxy_redirect off;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_intercept_errors off;
|
|
}
|
|
|
|
location / {
|
|
try_files $uri @dumpdom;
|
|
}
|
|
|
|
location @dumpdom {
|
|
proxy_set_header Host $host;
|
|
if ($uri ~* "\.(js|css|xml|less|png|jpg|jpeg|gif|pdf|doc|txt|ico|rss|zip|mp3|rar|exe|wmv|doc|avi|ppt|mpg|mpeg|tif|wav|mov|psd|ai|xls|mp4|m4a|swf|dat|dmg|iso|flv|m4v|torrent|ttf|woff|svg|eot)") {
|
|
set $dumpdom 0;
|
|
}
|
|
if ($dumpdom = 1) {
|
|
proxy_pass http://127.0.0.1:9292;
|
|
}
|
|
if ($dumpdom = 0) {
|
|
rewrite .* /index.html break;
|
|
}
|
|
}
|
|
}
|