Per the owner's spec: each social connection gets publishGovernance in its fields — unset = manual publish (today), auto = dispatch on approval, admin1/admin_majority/admin_consensus = a publish-phase chatgov poll (subject draft_publish, its own open-poll slot, no collision with review gates). Dispatch holds until the publish poll passes (E3 pre-dispatch check); auto dispatches on approval. Includes migration 033, the PATCH /connections/:id/publish-governance route (chatgov.manage), and 19+31 new tests. Implementation by the branding-panel process (claude/opus), lint and integration fixes here.
445 lines
15 KiB
Nginx Configuration File
445 lines
15 KiB
Nginx Configuration File
# occupymedia.cc edge — Cloudflare origin-pull terminator.
|
|
# Mirrors the tunnel ingress: host-routed reverse proxy in front of the apps.
|
|
# TLS: Let's Encrypt wildcard (dns-01). HTTP: redirect only.
|
|
|
|
worker_processes auto;
|
|
events { worker_connections 1024; }
|
|
|
|
http {
|
|
include /etc/nginx/mime.types;
|
|
default_type application/octet-stream;
|
|
sendfile on;
|
|
server_tokens off;
|
|
|
|
map $http_upgrade $connection_upgrade {
|
|
default upgrade;
|
|
"" close;
|
|
}
|
|
|
|
# Lets the remote failover probe tell edge-served responses from tunnel-served.
|
|
add_header X-Served-By occ-edge always;
|
|
|
|
# HTTP: redirect everything to HTTPS.
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
|
|
# Public apps. Origins mirror the cloudflared ingress:
|
|
# app -> occ-app web:3001 api -> occ-app api:3000
|
|
# tube -> occ-tube 9000 chat -> occ-chat 6167
|
|
server {
|
|
listen 443 ssl;
|
|
listen [::]:443 ssl;
|
|
http2 on;
|
|
server_name app.occupymedia.cc;
|
|
|
|
ssl_certificate /etc/letsencrypt/live/occupymedia.cc/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/occupymedia.cc/privkey.pem;
|
|
|
|
client_max_body_size 512m;
|
|
location / {
|
|
proxy_pass http://web:3001;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto https;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
proxy_read_timeout 3600s;
|
|
proxy_send_timeout 3600s;
|
|
}
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl;
|
|
listen [::]:443 ssl;
|
|
http2 on;
|
|
server_name api.occupymedia.cc;
|
|
|
|
ssl_certificate /etc/letsencrypt/live/occupymedia.cc/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/occupymedia.cc/privkey.pem;
|
|
|
|
client_max_body_size 512m;
|
|
location / {
|
|
proxy_pass http://api:3000;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto https;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
proxy_read_timeout 3600s;
|
|
proxy_send_timeout 3600s;
|
|
}
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl;
|
|
listen [::]:443 ssl;
|
|
server_name tube.occupymedia.cc;
|
|
|
|
ssl_certificate /etc/letsencrypt/live/occupymedia.cc/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/occupymedia.cc/privkey.pem;
|
|
|
|
client_max_body_size 0;
|
|
location / {
|
|
proxy_pass http://100.92.231.98:9000;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto https;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
proxy_read_timeout 3600s;
|
|
proxy_send_timeout 3600s;
|
|
proxy_buffering off;
|
|
}
|
|
}
|
|
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
server_name chat.occupymedia.cc;
|
|
# Tunnel origin path: the branded client on this host, Matrix API to the homeserver.
|
|
# Element redirects first-time phone visitors here before loading config.
|
|
# Send them to the form rather than the separate Element app-download hero.
|
|
location = /mobile_guide/ {
|
|
# Preserve the browser's HTTPS origin even on the tunnel's HTTP hop.
|
|
absolute_redirect off;
|
|
return 302 /#/login;
|
|
}
|
|
location = /hub-chat-auth.css {
|
|
alias /opt/occ-chat-brand/hub-chat-auth.css;
|
|
default_type text/css;
|
|
add_header X-Served-By occ-edge always;
|
|
add_header Cache-Control "no-cache" always;
|
|
}
|
|
location ^~ /_matrix {
|
|
proxy_pass http://100.117.210.52:6167;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto http;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
proxy_read_timeout 3600s;
|
|
proxy_send_timeout 3600s;
|
|
}
|
|
location ^~ /.well-known/matrix/ {
|
|
default_type application/json;
|
|
return 200 '{"m.homeserver":{"base_url":"https://chat.occupymedia.cc"}}';
|
|
}
|
|
# Hub in-app Chat: sign-in bootstrap on Element's own origin (see hub-sso/chat-sso.html).
|
|
location = /hub-sso.html {
|
|
alias /opt/hub-sso/chat-sso.html;
|
|
default_type text/html;
|
|
add_header X-Served-By occ-edge always;
|
|
add_header Cache-Control "no-store" always;
|
|
add_header Content-Security-Policy "default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; frame-ancestors https://app.occupymedia.cc" always;
|
|
}
|
|
location / {
|
|
proxy_pass http://occ-element:80;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
# Hash routes never reach nginx. Inject into the SPA HTML shell; the
|
|
# stylesheet only targets mx_AuthPage and leaves signed-in rooms alone.
|
|
proxy_set_header Accept-Encoding "";
|
|
sub_filter '</head>' '<link rel="stylesheet" href="/hub-chat-auth.css?v=1"></head>';
|
|
sub_filter_once on;
|
|
# text/html is sub_filter's default type; JSON/JS/CSS are not rewritten.
|
|
proxy_read_timeout 60s;
|
|
}
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl;
|
|
listen [::]:443 ssl;
|
|
server_name chat.occupymedia.cc;
|
|
|
|
ssl_certificate /etc/letsencrypt/live/occupymedia.cc/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/occupymedia.cc/privkey.pem;
|
|
|
|
location = /mobile_guide/ {
|
|
absolute_redirect off;
|
|
return 302 /#/login;
|
|
}
|
|
location = /hub-chat-auth.css {
|
|
alias /opt/occ-chat-brand/hub-chat-auth.css;
|
|
default_type text/css;
|
|
add_header X-Served-By occ-edge always;
|
|
add_header Cache-Control "no-cache" always;
|
|
}
|
|
|
|
location ^~ /_matrix {
|
|
proxy_pass http://100.117.210.52:6167;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto https;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
proxy_read_timeout 3600s;
|
|
proxy_send_timeout 3600s;
|
|
}
|
|
location = /.well-known/matrix/client {
|
|
default_type application/json;
|
|
return 200 '{"m.homeserver":{"base_url":"https://chat.occupymedia.cc"}}';
|
|
}
|
|
location = /.well-known/matrix/server {
|
|
default_type application/json;
|
|
return 200 '{"m.server":"chat.occupymedia.cc:443"}';
|
|
}
|
|
# Hub in-app Chat: sign-in bootstrap on Element's own origin (see hub-sso/chat-sso.html).
|
|
location = /hub-sso.html {
|
|
alias /opt/hub-sso/chat-sso.html;
|
|
default_type text/html;
|
|
add_header X-Served-By occ-edge always;
|
|
add_header Cache-Control "no-store" always;
|
|
add_header Content-Security-Policy "default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; frame-ancestors https://app.occupymedia.cc" always;
|
|
}
|
|
location / {
|
|
proxy_pass http://occ-element:80;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto https;
|
|
proxy_set_header Accept-Encoding "";
|
|
sub_filter '</head>' '<link rel="stylesheet" href="/hub-chat-auth.css?v=1"></head>';
|
|
sub_filter_once on;
|
|
proxy_read_timeout 60s;
|
|
}
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl;
|
|
listen [::]:443 ssl;
|
|
server_name ping.occupymedia.cc;
|
|
ssl_certificate /etc/letsencrypt/live/occupymedia.cc/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/occupymedia.cc/privkey.pem;
|
|
return 200 "edge-ok";
|
|
}
|
|
|
|
# Hub branding overrides for the oCIS web client: theme json + assets are
|
|
# served by the edge; every other path proxies into oCIS. Also the tunnel
|
|
# origin path (:80) so both ingress paths get the same branding.
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
server_name files.occupymedia.cc;
|
|
location = /themes/owncloud/theme.json {
|
|
default_type application/json;
|
|
alias /opt/occ-brand/hub-theme.json;
|
|
}
|
|
location /themes/owncloud/assets/ {
|
|
alias /opt/occ-brand/;
|
|
}
|
|
location / {
|
|
proxy_pass http://192.168.13.210:9200;
|
|
# Hub in-app Drive frames oCIS web from app.occupymedia.cc: framing policy
|
|
# lives in oCIS csp.yaml (frame-ancestors); drop the legacy SAMEORIGIN.
|
|
proxy_hide_header X-Frame-Options;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto https;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
proxy_read_timeout 3600s;
|
|
proxy_send_timeout 3600s;
|
|
proxy_buffering off;
|
|
client_max_body_size 512m;
|
|
}
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl;
|
|
listen [::]:443 ssl;
|
|
server_name files.occupymedia.cc;
|
|
|
|
ssl_certificate /etc/letsencrypt/live/occupymedia.cc/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/occupymedia.cc/privkey.pem;
|
|
|
|
client_max_body_size 512m;
|
|
location = /themes/owncloud/theme.json {
|
|
default_type application/json;
|
|
alias /opt/occ-brand/hub-theme.json;
|
|
}
|
|
location = /themes/owncloud/hub-signin.css {
|
|
default_type text/css;
|
|
alias /opt/occ-brand/hub-signin.css;
|
|
}
|
|
location /themes/owncloud/assets/ {
|
|
alias /opt/occ-brand/;
|
|
}
|
|
# The oCIS idp sign-in page ships ownCloud's light theme; restyle it into
|
|
# the Hub palette at the edge until oCIS sits behind the Hub OIDC issuer
|
|
# (docs/design/2026-10-13-files-oidc-sso.md).
|
|
location /signin/ {
|
|
proxy_pass http://192.168.13.210:9200;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
# sub_filter cannot rewrite upstream-gzipped bodies; force plain HTML.
|
|
proxy_set_header Accept-Encoding "";
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto https;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
proxy_read_timeout 3600s;
|
|
proxy_send_timeout 3600s;
|
|
proxy_buffering off;
|
|
sub_filter '</head>' '<link rel="stylesheet" href="/themes/owncloud/hub-signin.css"></head>';
|
|
sub_filter_once on;
|
|
sub_filter_types text/html;
|
|
}
|
|
location / {
|
|
proxy_pass http://192.168.13.210:9200;
|
|
# Hub in-app Drive frames oCIS web from app.occupymedia.cc: framing policy
|
|
# lives in oCIS csp.yaml (frame-ancestors); drop the legacy SAMEORIGIN.
|
|
proxy_hide_header X-Frame-Options;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto https;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
proxy_read_timeout 3600s;
|
|
proxy_send_timeout 3600s;
|
|
proxy_buffering off;
|
|
}
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl;
|
|
listen [::]:443 ssl;
|
|
server_name office.occupymedia.cc;
|
|
|
|
ssl_certificate /etc/letsencrypt/live/occupymedia.cc/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/occupymedia.cc/privkey.pem;
|
|
|
|
location / {
|
|
proxy_pass http://192.168.13.210:9980;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto https;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
proxy_read_timeout 3600s;
|
|
proxy_send_timeout 3600s;
|
|
}
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl;
|
|
listen [::]:443 ssl;
|
|
server_name intake.occupymedia.cc;
|
|
|
|
ssl_certificate /etc/letsencrypt/live/occupymedia.cc/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/occupymedia.cc/privkey.pem;
|
|
|
|
client_max_body_size 20m;
|
|
location / {
|
|
proxy_pass http://occ-intake:3000;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto https;
|
|
proxy_read_timeout 60s;
|
|
}
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl;
|
|
listen [::]:443 ssl;
|
|
server_name element.occupymedia.cc;
|
|
|
|
ssl_certificate /etc/letsencrypt/live/occupymedia.cc/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/occupymedia.cc/privkey.pem;
|
|
|
|
location / {
|
|
proxy_pass http://occ-element:80;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto https;
|
|
}
|
|
}
|
|
|
|
# Mastodon instance (social): web :3030 and streaming :4040 bound on the
|
|
# CT host LAN IP; federation clients hit the same vhost as browsers.
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
server_name social.occupymedia.cc;
|
|
location ~ ^/api/v1/streaming {
|
|
proxy_pass http://192.168.13.221:4040;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto http;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
proxy_read_timeout 3600s;
|
|
proxy_send_timeout 3600s;
|
|
proxy_buffering off;
|
|
}
|
|
location / {
|
|
proxy_pass http://192.168.13.221:3030;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto http;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
proxy_read_timeout 3600s;
|
|
proxy_send_timeout 3600s;
|
|
proxy_buffering off;
|
|
client_max_body_size 80m;
|
|
}
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl;
|
|
listen [::]:443 ssl;
|
|
server_name social.occupymedia.cc;
|
|
|
|
ssl_certificate /etc/letsencrypt/live/occupymedia.cc/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/occupymedia.cc/privkey.pem;
|
|
|
|
client_max_body_size 80m;
|
|
location ~ ^/api/v1/streaming {
|
|
proxy_pass http://192.168.13.221:4040;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto https;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
proxy_read_timeout 3600s;
|
|
proxy_send_timeout 3600s;
|
|
proxy_buffering off;
|
|
}
|
|
location / {
|
|
proxy_pass http://192.168.13.221:3030;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto https;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
proxy_read_timeout 3600s;
|
|
proxy_send_timeout 3600s;
|
|
proxy_buffering off;
|
|
}
|
|
}
|
|
|
|
# Everything else on this IP: drop the connection.
|
|
server {
|
|
listen 443 ssl default_server;
|
|
listen [::]:443 ssl default_server;
|
|
ssl_reject_handshake on;
|
|
}
|
|
}
|