Files
selfphoneng/deploy/nginx/selfphoneng.conf.example
T
iamdoubz 692dd59552
ci / check (push) Successful in 1m0s
ci / images (push) Successful in 32s
contacts: Contrack as the robust contacts (C3), picked in Settings or the setup wizard
Spec 11 §4: contacts.provider and contacts.contrack (local address only, company token
write-only), each person's own token (users.contrack_token_enc, migration 0010) in My settings,
books read from Contrack with a 5-minute cache, Add to contacts and accepted shares created in
Contrack, the company account on desk phones. Setup wizard step 8 Contacts. deploy/contrack
(2.0.2, pinned), Caddy/nginx blocks, decision 0003, admin guide Contacts. Tested against a fake
and a real Contrack 2.0.2 (contrack-live.test.ts).
2026-10-23 15:23:49 -05:00

64 lines
2.4 KiB
Plaintext

# SelfPhoneNG behind your own nginx. Replace pbx.example.com and the certificate paths.
#
# If port 443 is handled by an nginx `stream {}` block that forwards with
# `proxy_protocol`, this server must instead:
# listen 127.0.0.1:<port> ssl proxy_protocol;
# set_real_ip_from 127.0.0.1;
# real_ip_header proxy_protocol;
# Otherwise the api sees every client as 127.0.0.1, which breaks login rate
# limiting and audit logs.
map $http_upgrade $connection_upgrade { default upgrade; '' close; }
server {
listen 443 ssl;
http2 on;
server_name pbx.example.com;
ssl_certificate /etc/letsencrypt/live/pbx.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/pbx.example.com/privkey.pem;
add_header Strict-Transport-Security "max-age=31536000" always;
client_max_body_size 50m; # audio uploads
# SIP over WebSocket -> Asterisk
location = /ws {
proxy_pass http://127.0.0.1:8088/ws;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_read_timeout 3600s;
proxy_send_timeout 3600s;
}
# Everything else (UI, API, live WebSocket /api/live, provisioning) -> api
location / {
proxy_pass http://127.0.0.1:8080;
proxy_http_version 1.1;
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_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_read_timeout 3600s;
}
}
# Contrack (spec 11 §4), when you run deploy/contrack: its own name (it can't live under a path).
# server {
# listen 443 ssl;
# http2 on;
# server_name contacts.example.com;
# ssl_certificate /etc/letsencrypt/live/contacts.example.com/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/contacts.example.com/privkey.pem;
# client_max_body_size 50m; # contact imports and attachments
# location / {
# proxy_pass http://127.0.0.1:3210;
# proxy_set_header Host $host;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header X-Forwarded-Proto $scheme;
# }
# }