{"id":281955,"date":"2016-12-04T12:10:03","date_gmt":"2016-12-04T09:10:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=281955"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=281955","title":{"rendered":"Unifi Controller + Nginx. HTTP &#038; HTTPS"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/cloud.kilograpp.com\/f\/8ae032b0be\/?dl=1\" alt=\"image\"\/><\/p>\n<p>  <\/p>\n<h4 id=\"kratkaya-sut\"><strong>\u041a\u0440\u0430\u0442\u043a\u0430\u044f \u0441\u0443\u0442\u044c:<\/strong><\/h4>\n<p>  <\/p>\n<p>\u041f\u043e\u0448\u0430\u0433\u043e\u0432\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e \u043f\u0440\u043e\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e Unifi-\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0447\u0435\u0440\u0435\u0437 Nginx \u043f\u043e http \u0438\u043b\u0438 https. <\/p>\n<p>  <\/p>\n<p>\u041a\u043e\u043d\u0444\u0438\u0433\u0438, \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b, \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h4 id=\"prolog\"><strong>\u041f\u0440\u043e\u043b\u043e\u0433<\/strong>:<\/h4>\n<p>  <\/p>\n<p>\u041d\u0430\u0448\u0430 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u0438 \u043a\u0430\u043a \u0432\u044b \u043c\u043e\u0433\u043b\u0438 \u0434\u043e\u0433\u0430\u0434\u0430\u0442\u044c\u0441\u044f, \u0432 \u043e\u0444\u0438\u0441\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0434\u0435\u0432\u0430\u0439\u0441\u043e\u0432, \u0432\u0441\u0435 \u043e\u043d\u0438 \u043b\u044e\u0431\u044f\u0442 Wi-Fi \u0438 \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e Wi-Fi, \u0430 \u0431\u0435\u0441\u0448\u043e\u0432\u043d\u044b\u0439, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e \u043f\u043e\u0433\u0443\u043b\u044f\u0442\u044c \u043f\u043e \u043a\u043e\u0440\u0438\u0434\u043e\u0440\u0443, \u043d\u0435 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u044f \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u044b \u043f\u043e Skype, \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u0441\u043b\u0430\u0436\u0434\u0430\u0442\u044c\u0441\u044f \u0432\u0441\u0435\u043c\u0438 \u043f\u043b\u043e\u0434\u0430\u043c\u0438 \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u043e\u0439 \u0432\u0430\u0444\u043b\u0438. <\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u0438\u0445 \u0446\u0435\u043b\u0435\u0439 \u0440\u0435\u0448\u0438\u043b\u0438 \u0432\u0437\u044f\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e <a href=\"https:\/\/www.ubnt.com\/unifi\/unifi-ap-ac-lite\/\">Unifi<\/a> \u0442\u0430\u0440\u0435\u043b\u043e\u043a \u0441 \u0446\u0435\u043b\u044c\u044e \u043d\u0435 \u0437\u0430\u043c\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0441 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u043e\u0439 \u0438 \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438. \u041f\u043e-\u043a\u0440\u0443\u043f\u043d\u043e\u043c\u0443 \u0432\u0441\u0435 \u0442\u0430\u043a \u0438 \u0431\u044b\u043b\u043e \u0437\u0430 \u043e\u0434\u043d\u0438\u043c \u041d\u041e, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438 \u043f\u043e\u0441\u043b\u0443\u0436\u0438\u043b \u043f\u0440\u0438\u0447\u0438\u043d\u043e\u0439 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e tutorial: \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0442\u0430\u0440\u0435\u043b\u043e\u043a \u0443\u043c\u0435\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0435\u0440\u0435\u0437 https, \u0430 \u0442\u0430\u043a \u0436\u0435 \u043a \u043d\u0435\u043c\u0443 \u043d\u0435 \u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u043f\u043e \u043f\u0440\u043e\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u0447\u0435\u0440\u0435\u0437 Nginx, <a href=\"https:\/\/community.ubnt.com\/t5\/UniFi-Wireless\/UniFi-Ubuntu-16-04-fully-automatic-Installation-NGINX-Proxy-amp\/td-p\/1596848\">\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f<\/a>, \u043c\u044f\u0433\u043a\u043e \u0433\u043e\u0432\u043e\u0440\u044f, \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0436\u0435\u043b\u0430\u0442\u044c \u043b\u0443\u0447\u0448\u0435\u0433\u043e, \u0430 \u0442\u0430\u043a \u0436\u0435 \u043d\u0435 \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 HTTP.<\/p>\n<p>  <\/p>\n<h4 id=\"trebuemyy-uroven-podgotovki\"><strong>\u0422\u0440\u0435\u0431\u0443\u0435\u043c\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438:<\/strong><\/h4>\n<p>  <\/p>\n<p>\u0411\u0443\u0434\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u0447\u0442\u043e \u0430\u0437\u044b Nginx \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b, \u043a\u0443\u0434\u0430 \u043f\u043e\u043c\u0435\u0449\u0430\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0438 \u0438 \u0442\u0430\u043a \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0430 \u0441\u0430\u043c \u0432\u0435\u0431 \u0441\u0435\u0440\u0432\u0435\u0440 \u0442\u043e\u0436\u0435 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442. \u041a\u0440\u043e\u043c\u0435 \u044d\u0442\u043e\u0433\u043e, \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u043f\u043e\u0441\u0443\u0434\u044b \u0443\u0436\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d. \u0415\u0441\u043b\u0438 \u0441 \u044d\u0442\u0438\u043c \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438, \u0442\u043e \u0443 Ubiquity \u0435\u0441\u0442\u044c \u043e\u0442\u043b\u0438\u0447\u043d\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u0434\u043b\u044f <a href=\"https:\/\/help.ubnt.com\/hc\/en-us\/articles\/220066768-UniFi-How-to-Install-Update-via-APT-on-Debian-or-Ubuntu\">Linux<\/a> \u0438 <a href=\"https:\/\/help.ubnt.com\/hc\/en-us\/articles\/205144550--Outdated-UniFi-Run-the-controller-as-a-Windows-service\">Windows<\/a>. \u041d\u043e \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u0431\u0443\u0434\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u0447\u0442\u043e \u043c\u044b \u0432\u0441\u0435 \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u0436\u0436\u0435\u043d\u043d\u044b\u0435 \u043b\u0438\u043d\u0443\u043a\u0441\u043e\u0438\u0434\u044b.<\/p>\n<p>  <\/p>\n<p>\u0412\u0441\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b\u0430\u0441\u044c \u043d\u0430 Unifi Controller v5.2.9, Nginx v1.10.1, Debian Jessie, Java 8<\/p>\n<p>  <\/p>\n<p>\u0418 \u0442\u0430\u043a, \u043f\u043e\u0435\u0445\u0430\u043b\u0438. <\/p>\n<p>  <\/p>\n<h4 id=\"http\"><strong>HTTP:<\/strong><\/h4>\n<p>  <\/p>\n<p>\u0412\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e, \u043d\u0443\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433 \u043a\u0443\u0434\u0430 \u043d\u0430\u0434\u043e, \u043d\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u043f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u0438 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<p>\u0412\u0441\u0435\u043c, \u043a\u043e\u043c\u0443 \u043b\u0435\u043d\u044c <del>\u0434\u0443\u043c\u0430\u0442\u044c<\/del> \u0447\u0438\u0442\u0430\u0442\u044c, \u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u0434\u043e, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e, \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433 \u0438 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0432 \u043d\u0435\u043c server_name \u043d\u0430 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439, \u0430 \u0442\u0430\u043a \u0436\u0435 \u0430\u0434\u0440\u0435\u0441\/\u043f\u043e\u0440\u0442 \u0432 \u0431\u043b\u043e\u043a\u0435 upstream, \u0435\u0441\u043b\u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d \u043d\u0435 \u0432 \u043b\u043e\u043a\u0430\u043b\u0445\u043e\u0441\u0442\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"nginx\">upstream unifi {     server 127.0.0.1:8443; }  server {     listen 80;     server_name unifi.domain.com;      error_log \/var\/log\/unifi\/nginx.log;     access_log \/var\/log\/unifi\/access.log;      proxy_ssl_verify off;     proxy_ssl_session_reuse on;     proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2;      proxy_cache off;     proxy_store off;      server_tokens off;      location \/ {         proxy_set_header Referer &quot;&quot;;         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_pass https:\/\/unifi;            proxy_redirect https:\/\/ http:\/\/;         header_filter_by_lua_block {             if ngx.header[&quot;Set-Cookie&quot;] then                  ngx.header[&quot;Set-Cookie&quot;] = {                      string.gsub(ngx.header[&quot;Set-Cookie&quot;][1], &quot;(.*)Secure;(.*)&quot;, &quot;%1%2&quot;),                     string.gsub(ngx.header[&quot;Set-Cookie&quot;][2], &quot;(.*)Secure(.*)&quot;, &quot;%1%2&quot;)                  }             end         }     } } <\/code><\/pre>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 Nginx \u0441\u043e\u0431\u0440\u0430\u043d \u0438\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432, \u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c <a href=\"https:\/\/github.com\/openresty\/lua-nginx-module#installation\">ngx_http_lua_module<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c Nginx:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">sudo service nginx reload<\/code><\/pre>\n<p>  <\/p>\n<p><strong>\u041d\u044e\u0430\u043d\u0441\u044b:<\/strong><br \/>  \u0422\u0430\u043a \u043a\u0430\u043a \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e HTTPS, \u0442\u043e \u0434\u043b\u044f \u0435\u0433\u043e \u043f\u0440\u043e\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 HTTP \u043d\u0430\u043c \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c Cookie, \u043e\u0442\u0440\u0435\u0437\u0430\u0432 \u0444\u043b\u0430\u0433 secure, \u0438 \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043b\u044e\u0431\u0443\u044e \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e ssl upstream \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u0423\u0448\u043b\u044b\u0435 \u0430\u0434\u043c\u0438\u043d\u044b \u043a\u0438\u043d\u0443\u0442 \u0432 \u043c\u0435\u043d\u044f \u0442\u0430\u043f\u043a\u043e\u043c, \u0441\u043a\u0430\u0437\u0430\u0432, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442, \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0432 \u0435\u0433\u043e \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440, \u043d\u043e \u043c\u044b \u044d\u0442\u043e\u0442 \u043a\u0435\u0439\u0441 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0432 \u0432\u0438\u0434\u0443 \u0435\u0433\u043e \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u043e\u0439 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, <strong>\u043d\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f<\/strong> \u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043d\u044b\u0435 \u0432\u0435\u0449\u0438 \u043d\u0430 HTTP. \u0422\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u0442 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430, \u0430 \u0445\u043e\u0447\u0435\u0442\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u043a\u0440\u0430\u0441\u0438\u0432\u043e \u0442\u043e\u0440\u0447\u0430\u043b \u043d\u0430\u0440\u0443\u0436\u0443. <\/p>\n<p>  <\/p>\n<p>\u041c\u043e\u0436\u043d\u043e \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u0441\u043b\u0443\u0448\u0430\u044e\u0449\u0438\u0439 \u043f\u043e\u0440\u0442 \u0438 \u043b\u044e\u0431\u044b\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u043e \u0432\u043a\u0443\u0441\u0443. <\/p>\n<p>  <\/p>\n<h4 id=\"https-s-defoltnym-sertifikatom-kontrollera\"><strong>HTTPS \u0441 \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u043c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430:<\/strong><\/h4>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u043b\u0435\u043d\u0438\u0432\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 HTTPS. \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0438\u043c\u0435\u0435\u0442 \u0441\u0432\u043e\u0439 ssl \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438, \u043d\u043e \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430 \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439. \u0418 \u0432\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0435\u0433\u043e \u0441\u043a\u0443\u0440\u043f\u0443\u043b\u0435\u0437\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c, \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u043c Nginx \u0441\u043e\u0433\u043b\u0430\u0448\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0432\u0441\u0435.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0441\u0442\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u0432\u0435\u0441\u044c \u0442\u0440\u0430\u0444\u0438\u043a \u0438\u0434\u0435\u0442 \u0438\u0437 <del>\u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u043e\u0432<\/del> \u0441\u0435\u0442\u0438 \u043f\u043e HTTPS \u0434\u043e Nginx, \u0430 \u043e\u0442 Nginx \u043a \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0443 \u0443\u0436\u0435 \u043d\u0435\u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u044b\u0439. \u0415\u0441\u043b\u0438 Unifi \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0438 Nginx \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u043b\u043e\u043a\u0430\u043b\u0445\u043e\u0441\u0442\u0430 \u0438\u043b\u0438 \u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u0438, \u0442\u043e \u044d\u0442\u043e \u043d\u0430\u0448 \u0441\u043b\u0443\u0447\u0430\u0439: <\/p>\n<p>  <\/p>\n<pre><code class=\"nginx\">upstream unifi {     server 127.0.0.1:8443; }  # \u0420\u0435\u0434\u0438\u0440\u0435\u043a\u0442\u0438\u043c \u043d\u0430 HTTPS server {     listen       80;     server_name  unifi.domain.com;     server_tokens off;     rewrite ^ https:\/\/$http_host$request_uri?; }  server {     listen 443 ssl;     server_name unifi.domain.com;      error_log \/var\/log\/unifi\/nginx.log;     access_log \/var\/log\/unifi\/access.log;        ssl on;     ssl_certificate \/etc\/nginx\/ssl\/server.crt;     ssl_certificate_key \/etc\/nginx\/ssl\/server.key;     ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:!ADH:!AECDH:!MD5;     ssl_prefer_server_ciphers on;     ssl_protocols TLSv1 TLSv1.1 TLSv1.2;     ssl_session_cache shared:SSL:10m;     ssl_session_timeout 5m;     add_header Strict-Transport-Security &quot;max-age=31536000&quot; always;     server_tokens off;      proxy_ssl_verify off;     proxy_ssl_session_reuse on;     proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2;     proxy_cache off;     proxy_store off;      location \/ {         proxy_set_header Referer &quot;&quot;;         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_pass https:\/\/unifi;     } }<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\n<p>\u041c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0435\u0440\u043c\u0430\u043d\u0435\u043d\u0442\u043d\u044b\u0439 \u0440\u0435\u0434\u0438\u0440\u0435\u043a\u0442, \u0437\u0430\u043c\u0435\u043d\u0438\u0432 <\/p>\n<p>  <\/p>\n<pre><code class=\"nginx\">rewrite ^ https:\/\/$http_host$request_uri?;<\/code><\/pre>\n<p>  <\/p>\n<p>\u043d\u0430<\/p>\n<p>  <\/p>\n<pre><code class=\"nginx\">rewrite ^ https:\/\/$http_host$request_uri? permanent;<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u043e \u043b\u0443\u0447\u0448\u0435 \u044d\u0442\u0438\u043c \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0443\u0431\u0435\u0434\u0438\u043b\u0438\u0441\u044c \u0432 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u0435 \u0432\u0441\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b. <\/p>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0435 \u043d\u0430\u0434\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043d\u0430 \u0441\u0432\u043e\u0438:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u041f\u0443\u0442\u044c \u0434\u043e \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430 ssl_certificate<\/li>\n<li>\u041f\u0443\u0442\u044c \u0434\u043e \u043a\u043b\u044e\u0447\u0430 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430 ssl_certificate_key<\/li>\n<li>\u0418\u043c\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043e\u0431\u043e\u0438\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432(ssl \u0438 \u0440\u0435\u0434\u0438\u0440\u0435\u043a\u0442) server_name<\/li>\n<li>\u041f\u043e\u0440\u0442 \u0438 \u0430\u0434\u0440\u0435\u0441 upstream \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0418 \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u0434\u0435\u043b\u0430\u0442\u044c reload Nginx:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">sudo service nginx reload<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043f\u0440\u043e\u0441\u0438\u0442\u044c: &quot;\u041d\u043e \u043c\u044d\u043d, \u043f\u043e\u0447\u0435\u043c\u0443 \u0432 \u0442\u0432\u043e\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0435 \u0434\u0432\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0445\u043e\u0442\u044f \u0443 \u043c\u0435\u043d\u044f \u043e\u043d \u043e\u0434\u0438\u043d?&quot;. \u042f \u043e\u0442\u0432\u0435\u0447\u0443: \u043e\u0434\u0438\u043d \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 ssl \u0442\u0440\u0430\u0444\u0438\u043a, \u043f\u0440\u043e\u043a\u0441\u0438\u0440\u0443\u044f \u0435\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0443, \u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u0440\u0435\u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0442 \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439, \u0435\u0441\u043b\u0438 \u043a \u043d\u0430\u043c \u043e\u0431\u0440\u0430\u0442\u0438\u043b\u0438\u0441\u044c \u043f\u043e HTTP, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u043e\u0434\u0432\u0435\u0440\u0433\u0430\u0442\u044c \u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u0448\u0438 \u0434\u044b\u0440\u044b \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438. <\/p>\n<p>  <\/p>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0441\u0430\u043c\u043e\u0435 \u0441\u043b\u0430\u0434\u043a\u043e\u0435, \u0434\u043b\u044f <del>\u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0445 \u043f\u0430\u0440\u0430\u043d\u043e\u0438\u043a\u043e\u0432<\/del> \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u044b\u0445 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u043e\u0432.<\/p>\n<p>  <\/p>\n<h4 id=\"https-s-kastomnym-sertifikatom-kontrollera\"><strong>HTTPS \u0441 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u043c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430<\/strong><\/h4>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e Nginx \u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0435 \u0432 \u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 \u0438 \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0431\u044b\u0442\u044c \u043d\u0430 100% \u0443\u0432\u0435\u0440\u0435\u043d\u044b \u0432 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438. \u0412 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0430\u043c \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u044b\u0434\u0430\u043d\u043d\u044b\u043c ssl \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u043c \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0434\u043e\u043c\u0435\u043d\u0430 \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440, \u043b\u0438\u0431\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0439. <\/p>\n<p>  <\/p>\n<p><a href=\"http:\/\/www.akadia.com\/services\/ssh_test_certificate.html\">\u041f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438<\/a> self signed \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430 \u043c\u044b \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0437\u0434\u0435\u0441\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u043c, \u043e\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0441\u0432\u0435\u043d\u043d\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e tutorial. \u0421\u0447\u0438\u0442\u0430\u0435\u043c, \u0447\u0442\u043e \u0443\u0436\u0435 \u0432\u0441\u0435 \u0433\u043e\u0442\u043e\u0432\u043e \u0438 \u043c\u044b \u043c\u043e\u043b\u043e\u0434\u0446\u044b.<\/p>\n<p>  <\/p>\n<p>\u0418 \u0442\u0430\u043a, \u0443\u0431\u0435\u0434\u0438\u043c\u0441\u044f, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043d\u0430 \u0440\u0443\u043a\u0430\u0445 <strong>crt<\/strong> \u0438 <strong>key<\/strong> \u0444\u0430\u0439\u043b\u044b, \u043e\u043d\u0438 \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0434\u043b\u043e\u0436\u0438\u0442\u044c \u043d\u0430\u0448 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 \u0432 Unifi \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440. \u0411\u0443\u0434\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u0447\u0442\u043e \u043e\u043d\u0438 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f <strong>unifi.crt<\/strong> \u0438 <strong>unifi.key<\/strong> \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e.<\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c <strong><a href=\"http:\/\/javadev.ru\/https\/ssl-keystore-java\/\">keystore<\/a><\/strong> \u0444\u0430\u0439\u043b \u0434\u043b\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0432 \u043f\u0430\u043f\u043a\u0435 \u0441 <strong>unifi.crt<\/strong> \u0438 <strong>unifi.key<\/strong> \u0432 \u043a\u043e\u0440\u043d\u0435. \u041d\u0435 \u0432\u0430\u0436\u043d\u043e, \u0433\u0434\u0435 \u043b\u0435\u0436\u0438\u0442 \u044d\u0442\u0430 \u043f\u0430\u043f\u043a\u0430, \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0432 \u0438\u0442\u043e\u0433\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">openssl pkcs12 -export -in unifi.crt -inkey unifi.key -out unifi.p12  keytool -importkeystore -deststorepass aircontrolenterprise -destkeypass aircontrolenterprise -destkeystore keystore -srckeystore unifi.p12 -srcstoretype PKCS12 -srcstorepass aircontrolenterprise<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0431\u0435\u0440\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 <strong>keystore<\/strong> \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u043c \u0435\u0433\u043e \u0432 \u043f\u0430\u043f\u043a\u0443 <strong>data<\/strong> \u0432 \u043a\u043e\u0440\u043d\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430. \u0414\u0435\u0444\u043e\u043b\u0442\u043d\u043e\u0435 \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u043f\u0430\u043f\u043a\u0438: <strong>\/usr\/lib\/unifi<\/strong>. \u0424\u0430\u0439\u043b \u0432 \u0438\u0442\u043e\u0433\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043f\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u043f\u0443\u0442\u0438: <strong>\/usr\/lib\/unifi\/data\/keystore<\/strong><\/p>\n<p>  <\/p>\n<p>P12 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u043a \u043d\u0430\u043c \u043d\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f, \u043c\u043e\u0436\u043d\u043e \u0435\u0433\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0438\u043b\u0438 \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043d\u0430 \u043f\u0430\u043c\u044f\u0442\u044c, \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0432 \u0432 \u0440\u0430\u043c\u043e\u0447\u043a\u0443.<\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0435\u0441\u0442\u0430\u0440\u0442\u0438\u043c \u0441\u0435\u0440\u0432\u0438\u0441 Unifi:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">sudo service unifi restart<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u043c \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0439 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f, \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u0435\u043b\u043e \u0437\u0430 Nginx. \u041d\u0430\u0448 \u043a\u043e\u043d\u0444\u0438\u0433 \u0431\u0443\u0434\u0435\u0442 \u043c\u0430\u043b\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0444\u0430\u043a\u0442\u0430, \u0447\u0442\u043e \u043c\u044b \u0443\u0436\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0441\u043b\u0435\u043f\u043e \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0439 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442. \u0415\u0441\u043b\u0438 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 self signed, \u0442\u043e \u0443\u043a\u0430\u0436\u0435\u043c Nginx \u0434\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0435\u043c\u0443.<\/p>\n<p>  <\/p>\n<p><strong>\u0421\u043b\u0443\u0447\u0430\u0439 \u0434\u043b\u044f \u0432\u044b\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430<\/strong><\/p>\n<p>  <\/p>\n<p>\u041a\u043e\u043d\u0444\u0438\u0433 Nginx:<\/p>\n<p>  <\/p>\n<pre><code class=\"nginx\">upstream unifi {     server 127.0.0.1:8443; }  server {     listen       80;     server_name  unifi.domain.com;     server_tokens off;     rewrite ^ https:\/\/$http_host$request_uri?; }  server {     listen 443 ssl;     server_name unifi.domain.com;      error_log \/var\/log\/unifi\/nginx.log;     access_log \/var\/log\/unifi\/access.log;        ssl on;     ssl_certificate \/etc\/nginx\/ssl\/server.crt;     ssl_certificate_key \/etc\/nginx\/ssl\/server.key;     ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:!ADH:!AECDH:!MD5;     ssl_prefer_server_ciphers on;     ssl_protocols TLSv1 TLSv1.1 TLSv1.2;     ssl_session_cache shared:SSL:10m;     ssl_session_timeout 5m;     add_header Strict-Transport-Security &quot;max-age=31536000&quot; always;     server_tokens off;      proxy_ssl_session_reuse on;      location \/ {         proxy_set_header Referer &quot;&quot;;         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_pass https:\/\/unifi;     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0432\u0442\u043e\u0440\u044e\u0441\u044c, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0430:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u041f\u0443\u0442\u044c \u0434\u043e \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430 ssl_certificate<\/li>\n<li>\u041f\u0443\u0442\u044c \u0434\u043e \u043a\u043b\u044e\u0447\u0430 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430 ssl_certificate_key<\/li>\n<li>\u0418\u043c\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043e\u0431\u043e\u0438\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432(ssl \u0438 \u0440\u0435\u0434\u0438\u0440\u0435\u043a\u0442) server_name<\/li>\n<li>\u041f\u043e\u0440\u0442 \u0438 \u0430\u0434\u0440\u0435\u0441 upstream \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438<\/li>\n<\/ul>\n<p>  <\/p>\n<p><strong>\u0422\u0435\u043f\u0435\u0440\u044c self signed \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442:<\/strong><\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f \u0434\u0432\u0430 \u0443\u0436\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u044b\u0445 \u0444\u0430\u0439\u043b\u0430 \u0438\u0437 \u043f\u0440\u043e\u0448\u043b\u044b\u0445 \u0448\u0430\u0433\u043e\u0432: <strong>unifi.crt<\/strong> \u0438 <strong>unifi.key<\/strong>. \u0414\u043b\u044f \u0432\u044b\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430 \u043e\u043d\u0438 \u043d\u0430\u043c \u043d\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u0438\u0441\u044c, \u0442\u0430\u043a \u043a\u0430\u043a Nginx \u0443\u043c\u043d\u0435\u043d\u044c\u043a\u0438\u0439 \u0438 \u0443\u043c\u0435\u0435\u0442 \u0432\u0430\u043b\u0438\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u0432 \u0431\u044e\u0440\u043e \u0441\u0435\u0440\u0442\u0438\u0444\u043a\u0430\u0446\u0438\u0438. \u0417\u0434\u0435\u0441\u044c \u0436\u0435 \u043d\u0430\u043c \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0435\u043c\u0443 \u044f\u0432\u043d\u043e \u0438\u0445 \u0443\u043a\u0430\u0437\u0430\u0442\u044c. <\/p>\n<p>  <\/p>\n<p>\u041a\u043e\u043d\u0444\u0438\u0433 Nginx:<\/p>\n<p>  <\/p>\n<pre><code class=\"nginx\">upstream unifi {     server 127.0.0.1:8443; }  server {     listen       80;     server_name  unifi.domain.com;     server_tokens off;     rewrite ^ https:\/\/$http_host$request_uri?; }  server {     listen 443 ssl;     server_name unifi.domain.com;      error_log \/var\/log\/unifi\/nginx.log;     access_log \/var\/log\/unifi\/access.log;        ssl on;     ssl_certificate \/etc\/nginx\/ssl\/server.crt;     ssl_certificate_key \/etc\/nginx\/ssl\/server.key;     ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:!ADH:!AECDH:!MD5;     ssl_prefer_server_ciphers on;     ssl_protocols TLSv1 TLSv1.1 TLSv1.2;     ssl_session_cache shared:SSL:10m;     ssl_session_timeout 5m;     add_header Strict-Transport-Security &quot;max-age=31536000&quot; always;     server_tokens off;      proxy_ssl_verify on;     proxy_ssl_certificate     \/etc\/nginx\/ssl\/unifi.crt;     proxy_ssl_certificate_key \/etc\/nginx\/ssl\/unifi.key;     proxy_ssl_trusted_certificate \/etc\/nginx\/ssl\/unifi.crt;     proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2;     proxy_ssl_session_reuse on;      location \/ {         proxy_set_header Referer &quot;&quot;;         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_pass https:\/\/unifi;     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0438 \u0432\u044b\u0448\u0435, \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u0437\u0430\u043c\u0435\u043d\u044f\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0430 \u043d\u0430 \u0441\u0432\u043e\u0438:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u041f\u0443\u0442\u044c \u0434\u043e \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430 ssl_certificate<\/li>\n<li>\u041f\u0443\u0442\u044c \u0434\u043e \u043a\u043b\u044e\u0447\u0430 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430 ssl_certificate_key<\/li>\n<li>\u0418\u043c\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043e\u0431\u043e\u0438\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432(ssl \u0438 \u0440\u0435\u0434\u0438\u0440\u0435\u043a\u0442) server_name<\/li>\n<li>\u041f\u043e\u0440\u0442 \u0438 \u0430\u0434\u0440\u0435\u0441 upstream \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438<br \/>  <strong>\u0410 \u0442\u0430\u043a\u0436\u0435<\/strong><\/li>\n<li>\u041f\u0443\u0442\u044c \u0434\u043e <strong>unifi.crt<\/strong> \u0438 <strong>unifi.key<\/strong> \u0444\u0430\u0439\u043b\u043e\u0432 (\u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u043a\u0443\u0434\u0430 \u0443\u0433\u043e\u0434\u043d\u043e. \u042f \u0431\u044b \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u043b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u043f\u0430\u043f\u043a\u0443 \u0432 \u043a\u043e\u0440\u043d\u0435 Nginx, \u0447\u0442\u043e\u0431\u044b \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043f\u043e\u0442\u0435\u0440\u044f\u043b\u043e\u0441\u044c)<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c Nginx:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">sudo service nginx reload<\/code><\/pre>\n<p>  <\/p>\n<hr\/>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u0438 \u0432\u0441\u0435, \u043c\u044b \u0434\u043e\u0431\u0438\u043b\u0438\u0441\u044c \u0436\u0435\u043b\u0430\u0435\u043c\u043e\u0433\u043e. \u041d\u0430\u0448 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043f\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c\u0443 \u0430\u0434\u0440\u0435\u0441\u0443. <\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u0441 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c<\/b><\/p>\n<div class=\"spoiler_text\">\n<p><img decoding=\"async\" src=\"https:\/\/cloud.kilograpp.com\/f\/9f897ef3d9\/?dl=1&amp;t=\" alt=\"image\"\/><\/p>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0411\u0443\u0434\u0443 \u0440\u0430\u0434 \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430 \u043b\u044e\u0431\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0438 \u043f\u0440\u0438\u043d\u044f\u0442\u044c \u043e\u0431\u0440\u0430\u0442\u043d\u0443\u044e \u0441\u0432\u044f\u0437\u044c.<\/p>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habrahabr.ru\/post\/316786\/\"> https:\/\/habrahabr.ru\/post\/316786\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/cloud.kilograpp.com\/f\/8ae032b0be\/?dl=1\" alt=\"image\"\/><\/p>\n<p>  <\/p>\n<h4 id=\"kratkaya-sut\"><strong>\u041a\u0440\u0430\u0442\u043a\u0430\u044f \u0441\u0443\u0442\u044c:<\/strong><\/h4>\n<p>  <\/p>\n<p>\u041f\u043e\u0448\u0430\u0433\u043e\u0432\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e \u043f\u0440\u043e\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e Unifi-\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0447\u0435\u0440\u0435\u0437 Nginx \u043f\u043e http \u0438\u043b\u0438 https. <\/p>\n<p>  <\/p>\n<p>\u041a\u043e\u043d\u0444\u0438\u0433\u0438, \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b, \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-281955","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/281955","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=281955"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/281955\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=281955"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=281955"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=281955"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}