Advertisement
Guest User

UniFi Controller nginx reverse proxy configuration

a guest
Jan 18th, 2018
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 2.07 KB | None | 0 0
  1. server {
  2.     listen 80 default_server;
  3.     listen [::]:80 default_server;
  4.     server_name example.com;
  5.     return 301 https://$host$request_uri;
  6. }
  7.  
  8. server {
  9.     listen 443 ssl http2 default_server;
  10.     listen [::]:443 ssl http2 default_server;
  11.     server_name example.com;
  12.  
  13.     ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
  14.     ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot
  15.     include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
  16.  
  17.     resolver 209.222.18.222 209.222.18.218 valid=300s;
  18.     resolver_timeout 5s;
  19.     add_header X-Frame-Options SAMEORIGIN;
  20.     add_header X-Content-Type-Options nosniff;
  21.     ssl_dhparam /etc/ssl/certs/dhparam4096.pem;
  22.     ssl_ecdh_curve secp384r1;
  23.     ssl_session_tickets off;
  24.     ssl_stapling on;
  25.     ssl_stapling_verify on;
  26.  
  27.     root /var/www/html;
  28.     index index.html index.html /_h5ai/public/index.php;
  29.  
  30.     error_page 403 404 /404.html;
  31.  
  32.     location / {
  33.         try_files $uri $uri/ =404;
  34.     }
  35.  
  36.     location ~ \.php$ {
  37.         include           snippets/fastcgi-php.conf;
  38.         fastcgi_pass      unix:/run/php/php7.0-fpm.sock;
  39.     }
  40.  
  41.     location ~ /\.ht {
  42.         deny              all;
  43.     }
  44.  
  45.     location ^~ /.well-known/acme-challenge/ {
  46.         autoindex         on;
  47.     }
  48.  
  49.     location /unifi {
  50.         return 302        /manage;
  51.     }
  52.  
  53.     location /manage {
  54.         proxy_pass        https://127.0.0.1:8443/manage;
  55.         proxy_ssl_verify  off;
  56.         include           /etc/nginx/proxy_params;
  57.     }
  58.  
  59.     location /status {
  60.         proxy_pass        https://127.0.0.1:8443/status;
  61.         proxy_ssl_verify  off;
  62.         include           /etc/nginx/proxy_params;
  63.     }
  64.  
  65.     location /api {
  66.         proxy_pass        https://127.0.0.1:8443/api;
  67.         proxy_ssl_verify  off;
  68.         include           /etc/nginx/proxy_params;
  69.     }
  70.  
  71.     location /wss {
  72.         proxy_pass        https://127.0.0.1:8443/wss;
  73.         proxy_ssl_verify  off;
  74.         include           /etc/nginx/proxy_params;
  75.     }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement