From 66ee526bfac3ace8670a2aae7da05739a93f67dc Mon Sep 17 00:00:00 2001 From: Pavel Lobashov Date: Thu, 6 Apr 2017 17:26:47 +0300 Subject: [PATCH] new server nginx settings WIthout it - port redirect not worked properly --- onlyoffice-documentserver | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/onlyoffice-documentserver b/onlyoffice-documentserver index 8f9e738..f5c1613 100644 --- a/onlyoffice-documentserver +++ b/onlyoffice-documentserver @@ -1,21 +1,41 @@ +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 Host $http_host; +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; + server { listen 0.0.0.0:80; listen [::]:80 default_server; server_tokens off; rewrite ^\/OfficeWeb(\/apps\/.*)$ /web-apps$1 redirect; + location / { proxy_pass http://localhost:8000; proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - proxy_set_header Host $host; - proxy_set_header X-Forwarded-Host $server_name; - proxy_set_header X-Forwarded-Proto $scheme; } location /spellchecker/ { proxy_pass http://localhost:8080/; proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; } }