Ship TLS nginx for backoffice, keep HTTP bootstrap until certs exist, proxy /monitoring to sentry-relay, and tunnel server/edge Sentry through Finland.
70 lines
2.1 KiB
Plaintext
70 lines
2.1 KiB
Plaintext
# Admin backoffice — TLS terminated by Nginx, app on 127.0.0.1:3009
|
|
#
|
|
# Requires:
|
|
# - DNS A for backoffice.ghabilee.ir → this VPS
|
|
# - certbot cert: /etc/letsencrypt/live/backoffice.ghabilee.ir/
|
|
# - ghabilee site enabled (provides $connection_upgrade map)
|
|
#
|
|
# Issue / renew:
|
|
# certbot certonly --webroot -w /var/www/html -d backoffice.ghabilee.ir
|
|
|
|
upstream ghabilee_admin {
|
|
server 127.0.0.1:3009;
|
|
keepalive 16;
|
|
}
|
|
|
|
# HTTP → ACME + redirect to HTTPS
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
server_name backoffice.ghabilee.ir;
|
|
|
|
location /.well-known/acme-challenge/ {
|
|
root /var/www/html;
|
|
}
|
|
|
|
location / {
|
|
return 301 https://backoffice.ghabilee.ir$request_uri;
|
|
}
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl;
|
|
listen [::]:443 ssl;
|
|
server_name backoffice.ghabilee.ir;
|
|
|
|
ssl_certificate /etc/letsencrypt/live/backoffice.ghabilee.ir/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/backoffice.ghabilee.ir/privkey.pem;
|
|
include /etc/letsencrypt/options-ssl-nginx.conf;
|
|
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
|
|
|
|
client_max_body_size 10m;
|
|
|
|
# Browser Sentry tunnel → Finland (ingest.de is blocked from Iran egress).
|
|
location = /monitoring {
|
|
proxy_pass https://sentry-relay.ghabilee.ir/monitoring;
|
|
proxy_ssl_server_name on;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host sentry-relay.ghabilee.ir;
|
|
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_connect_timeout 5s;
|
|
proxy_read_timeout 20s;
|
|
proxy_send_timeout 20s;
|
|
client_max_body_size 1m;
|
|
}
|
|
|
|
location / {
|
|
proxy_pass http://ghabilee_admin;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Host $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_read_timeout 60s;
|
|
}
|
|
}
|