hexabot/docker/nginx/secure/default.conf.template

75 lines
2.3 KiB
Plaintext
Raw Permalink Normal View History

2024-09-10 09:50:11 +00:00
server {
listen 80;
2024-09-13 08:38:49 +00:00
server_name ${APP_DOMAIN};
2024-09-10 09:50:11 +00:00
location / {
return 301 https://$host$request_uri;
}
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
}
server {
listen 443 ssl;
2024-09-13 08:38:49 +00:00
server_name ${APP_DOMAIN};
2024-09-10 09:50:11 +00:00
server_tokens off;
client_max_body_size 20M;
2024-09-13 08:38:49 +00:00
ssl_certificate /etc/letsencrypt/live/${APP_DOMAIN}/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/${APP_DOMAIN}/privkey.pem;
2024-09-10 09:50:11 +00:00
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
location / {
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Url-Scheme $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://frontend:8080;
}
location /api/ {
rewrite ^/api/?(.*)$ /$1 break;
proxy_pass http://api:3000;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
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_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header X-NginX-Proxy false;
proxy_pass_request_headers on;
}
location /widget/ {
rewrite ^/widget/?(.*)$ /$1 break;
proxy_pass http://widget:5173;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Url-Scheme $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
}
location ~* \.io {
rewrite ^/api/?(.*)$ /$1 break;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy false;
proxy_pass http://api:3000;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}