# unifi reverse proxy upstream unifi { server 127.0.0.1:8443; } # send http request to https server { listen 80; listen [::]:80; server_name >>your.server.name<<; rewrite ^(.*) https://$server_name$request_uri? permanent; } server { listen 443 ssl http2; listen [::]:443 ssl http2; server_name >>your.server.name<<; # SSL parameters # params include /etc/nginx/conf.d/ssl; # certs ssl_certificate /etc/ssl/certs/>>your cert here<<; ssl_certificate_key /etc/ssl/private/>>your key here<<; # log access_log /var/log/nginx/unifi.access.log; error_log /var/log/nginx/unifi.error.log; # Redirect requests to unifi backend server location / { proxy_pass https://unifi/; proxy_redirect https://unifi/ /; proxy_buffering off; proxy_read_timeout 60s; 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_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; } }