====== OnlyOffice.conf ======

<WRAP center round important 60%>
**__Не забываем менять доменное имя, IP и PORT!!!__**
</WRAP>


<code bash>upstream docservice {
  server IP;
}

map $http_host $this_host {
    "" $host;
    default $http_host;
}

map $http_x_forwarded_proto $the_scheme {
     default $http_x_forwarded_proto;
     "" $scheme;
}

map $http_x_forwarded_host $the_host {
    default $http_x_forwarded_host;
    "" $this_host;
}

map $http_upgrade $proxy_connection {
  default upgrade;
  "" close;
}

proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $proxy_connection;
proxy_set_header X-Forwarded-Host $the_host;
proxy_set_header X-Forwarded-Proto $the_scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;


server {
        listen 80;
        server_name of-edit.merrcloud.ru;
        return 301 https://$server_name$request_uri;
}
server {
        listen 443 ssl http2;
        server_name of-edit.merrcloud.ru;
        root /var/www/of-edit;
        access_log /var/log/nginx/of-edit.access.log;
        error_log /var/log/nginx/of-edit.error.log info;

        include /etc/nginx/ssl/ssl.conf;
        include /etc/nginx/snippets/sys.conf;

        add_header Strict-Transport-Security max-age=31536000;
        # add_header X-Frame-Options SAMEORIGIN;
        add_header X-Content-Type-Options nosniff;


        location / {
                proxy_pass http://IP;
                proxy_http_version 1.1;
                #proxy_set_header Upgrade $http_upgrade;
                #proxy_set_header Connection "Upgrade";
                #proxy_set_header Host $http_host;
#               index index.html;
        }

}

</code>