Try the fastest and simplest way to install ONLYOFFICE

Documents server configure nginx to use virtual path

Suggestions on Document Server Installation/Functionality

Documents server configure nginx to use virtual path

Postby SDUPJV » Mon Mar 19, 2018 12:01 pm

Hello,
First of all, sorry for my english writting.

I have to integrate Documents server (5.0.7) to Nextcloud (12.0.3) and I want to use a virtual path but I have not succeeded.

I want to configure a portal that redirect to my documents server :
https://XXX/docuserv -> http://YYY.XXX/docserv.
I have installed the document with the official instruction.
So, I have a nginx server on my documents sever. I try to configure it as this topic https://github.com/ONLYOFFICE/document-server-proxy/blob/master/nginx/proxy-to-virtual-path.conf.
But when I access to this url, I get this error : Cannot get /

Code: Select all
upstream docservice {
  server localhost:8000;
}

upstream spellchecker {
  server localhost:8080;
}

upstream example {
  server localhost:3000;
}

proxy_cache_path /var/cache/nginx/onlyoffice/documentserver/
  levels=1:2
  keys_zone=fonts_cache:1m
  inactive=1d
  max_size=256m;

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/docuserv;
proxy_set_header X-Forwarded-Proto $the_scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;


Code: Select all
#welcome page
rewrite ^/$ $the_scheme://$the_host/welcome/ redirect;

#support old version
rewrite ^\/OfficeWeb(\/apps\/.*)$ $the_scheme://$the_host/2018-02-15-16-12/web-apps$1 redirect;

#script caching protection
rewrite ^(\/web-apps\/apps\/(?!api\/).*)$ $the_scheme://$the_host/2018-02-15-16-12$1 redirect;

#disable caching for api.js
location ~ ^(\/2018-02-15-16-12)?\/(web-apps\/apps\/api\/documents\/api\.js)$ {
  expires -1;
  alias  /var/www/onlyoffice/documentserver//$2;
}

location ~ ^(\/2018-02-15-16-12)?\/(web-apps|sdkjs|sdkjs-plugins)(\/.*)$ {
  expires 365d;
  alias /var/www/onlyoffice/documentserver/$2$3;
}

location ~ ^(\/2018-02-15-16-12)?(\/fonts\/.*) {
  proxy_cache_min_uses 1;
  proxy_cache_key $scheme$proxy_host$uri$is_args$args;
  proxy_cache fonts_cache;
  proxy_cache_use_stale updating error timeout invalid_header http_500;
  proxy_cache_valid 1d;
  proxy_cache_methods GET HEAD;

  proxy_pass http://docservice$2;
}

location ~ ^(\/cache\/files.*)(\/.*) {
  alias /var/lib/onlyoffice/documentserver/App_Data$1;
  add_header Content-Disposition $arg_disposition;

  set $secret_string onlyoffice;
  secure_link $arg_md5,$arg_expires;
  secure_link_md5 "$secure_link_expires$uri$secret_string";

  if ($secure_link = "") {
    return 403;
  }

  if ($secure_link = "0") {
    return 410;
  }
}

location /docuserv/ {
  proxy_pass http://docservice/;
}

location ~ ^(\/2018-02-15-16-12)?(\/doc\/.*) {
  proxy_pass http://docservice$2;
  proxy_http_version 1.1;
}

location /2018-02-15-16-12/ {
  proxy_pass http://docservice/;
}


Thanks for your help
SDUPJV
 
Posts: 3
Joined: Mon Mar 19, 2018 8:22 am

Re: Documents server configure nginx to use virtual path

Postby Maxim » Wed Mar 21, 2018 9:25 am

Maxim
 
Posts: 1593
Joined: Tue Oct 11, 2016 2:34 pm

Re: Documents server configure nginx to use virtual path

Postby SDUPJV » Thu Mar 22, 2018 7:23 am

Hello and thank you Maxim but the link above is from this page.

I try this and I get this error message Cannot get /.

Best regards
SDUPJV
 
Posts: 3
Joined: Mon Mar 19, 2018 8:22 am

Re: Documents server configure nginx to use virtual path

Postby SDUPJV » Thu Mar 22, 2018 12:33 pm



Hi Maxim,
thanks for your reply. I have already try this but I always get this error cannot get /.

Best regards
SDUPJV
 
Posts: 3
Joined: Mon Mar 19, 2018 8:22 am

Re: Documents server configure nginx to use virtual path

Postby Maxim » Tue Apr 03, 2018 10:43 am

Hello SDUPJV!
Unfortunately have no idea.
Maxim
 
Posts: 1593
Joined: Tue Oct 11, 2016 2:34 pm


Return to Document Server

Who is online

Users browsing this forum: No registered users and 1 guest