262 lines
7.9 KiB
Nginx Configuration File
262 lines
7.9 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: browsers hitting the bare server root get the branded
|
|
# client; the Matrix API flows through untouched.
|
|
location = / {
|
|
return 302 https://element.occupymedia.cc;
|
|
}
|
|
# Client discovery for @user:chat.occupymedia.cc logins (tuwunel does not serve it).
|
|
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"}';
|
|
}
|
|
|
|
location / {
|
|
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;
|
|
}
|
|
}
|
|
|
|
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 = / {
|
|
return 302 https://element.occupymedia.cc;
|
|
}
|
|
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"}';
|
|
}
|
|
|
|
location / {
|
|
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;
|
|
}
|
|
}
|
|
|
|
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";
|
|
}
|
|
|
|
# Parity with the tunnel ingress: occ-files + Collabora live on CT 320.
|
|
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 / {
|
|
proxy_pass http://192.168.13.210:9200;
|
|
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;
|
|
}
|
|
}
|
|
|
|
# Everything else on this IP: drop the connection.
|
|
server {
|
|
listen 443 ssl default_server;
|
|
listen [::]:443 ssl default_server;
|
|
ssl_reject_handshake on;
|
|
}
|
|
}
|