57 lines
1.5 KiB
Org Mode
57 lines
1.5 KiB
Org Mode
server {
|
|
|
|
listen 443 ssl;
|
|
listen [::]:443 ssl;
|
|
|
|
server_name unifi.theribbles.org;
|
|
|
|
client_max_body_size 50m;
|
|
|
|
ssl_trusted_certificate /etc/nginx/certificates/unifi.pem;
|
|
|
|
# Needed to allow the websockets to forward well.
|
|
# Information adopted from here: https://community.ubnt.com/t5/EdgeMAX/Access-Edgemax-gui-via-nginx-reverse-proxy-websocket-problem/td-p/1544354
|
|
location /wss/ {
|
|
proxy_pass https://127.0.0.1:8443;
|
|
proxy_buffering off;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "Upgrade";
|
|
# Suggested at
|
|
# https://community.ui.com/questions/Websocket-issue-with-Unifi-Controller-behind-nginx/21030109-95b1-47e2-91fb-0153a89dd04d
|
|
# Adding it removed a websocket connection failure
|
|
proxy_set_header Origin '';
|
|
|
|
proxy_read_timeout 86400;
|
|
}
|
|
|
|
location / {
|
|
proxy_pass https://127.0.0.1:8443; #The UniFi Controller Port
|
|
proxy_redirect https://127.0.0.1:8443/ /;
|
|
proxy_buffering off;
|
|
proxy_read_timeout 60s;
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
|
|
}
|
|
|
|
ssl_certificate /etc/letsencrypt/live/theribbles.org/fullchain.pem; # managed by Certbot
|
|
ssl_certificate_key /etc/letsencrypt/live/theribbles.org/privkey.pem; # managed by Certbot
|
|
}
|
|
|
|
server {
|
|
if ($host = unifi.theribbles.org) {
|
|
return 301 https://$host$request_uri;
|
|
} # managed by Certbot
|
|
|
|
|
|
listen 80;
|
|
listen [::]:80;
|
|
|
|
server_name unifi.theribbles.org;
|
|
return 404; # managed by Certbot
|
|
}
|
|
|