Install command for docker after reverse proxy?

Hallo,

I have setup an reverse Proxy with nginx and connect the the Url onlyoffice.xxx.com:5000 for secure channel (with let’s encrypt).

What command must I call for correct install the docker onyloffice community doc for my configuration?

Thank you!
Michael

Hello Michael,
Please follow our guide to install ONLYOFFICE Docs with Docker:
https://helpcenter.onlyoffice.com/installation/docs-community-install-docker.aspx

You will also have to create a separate nginx config for correct proxying, please use our example:

Hello,
thanks for the information!

Now I have get the minimal.conf file:

#Use this example for proxy traffic to the document server running at 'backendserver-address'.

upstream docservice {
  server backendserver-address;
}

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 0.0.0.0:80;
  listen [::]:80 default_server;
  server_tokens off;

  location / {
    proxy_pass http://docservice;
    proxy_http_version 1.1;
  }
}

My docker ps command show this content:

CONTAINER ID   IMAGE                       COMMAND                  CREATED      STATUS      PORTS                                            NAMES
6e52372f4596   onlyoffice/documentserver   "/app/ds/run-documen…"   2 days ago   Up 2 days   443/tcp, 0.0.0.0:5000->80/tcp, :::5000->80/tcp   romantic_mirzakhani

What parameter must I change in the minimal.conf file?
Thank you!

Hello,
You need to replace backendserver-address with http://localhost:5000 and restart nginx.

Hello,

I have find the correct conf file: I need https to http:

upstream docservice {
  server http://localhost:5000;
}

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;

## Normal HTTP host
server {
  listen 0.0.0.0:80;
  listen [::]:80 default_server;
  server_name _;
  server_tokens off;

  ## Redirects all traffic to the HTTPS host
  return 301 https://$server_name:443$request_uri;
}

server {
  listen 0.0.0.0:443 ssl;
  listen [::]:443 ssl default_server;
  server_tokens off;
  root /usr/share/nginx/html;

  ## Strong SSL Security
  ## https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html
  ssl on;
  ssl_certificate /etc/letsencrypt/live/onlyoffice.domain.network/;
  ssl_certificate_key /etc/letsaencrypt/live/onlyoffice.domain.network/;
  ssl_verify_client off;

  ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";

  ssl_protocols  TLSv1 TLSv1.1 TLSv1.2;
  ssl_session_cache  builtin:1000  shared:SSL:10m;

  ssl_prefer_server_ciphers   on;
  add_header X-Content-Type-Options nosniff;

  location / {
    proxy_pass http://docservice;
    proxy_http_version 1.1;
  }
}

And then I restart with “systemctl restart nginx”
But I get an error:

● nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Thu 2022-04-28 13:49:13 CEST; 9s ago
       Docs: man:nginx(8)
    Process: 360467 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)

Apr 28 13:49:13 serv90514217 systemd[1]: Starting A high performance web server and a reverse proxy server...
Apr 28 13:49:13 serv90514217 nginx[360467]: nginx: [emerg] invalid host in upstream "http://localhost:5000" in /etc/nginx/conf.d/proxy-https-to-http.conf:2
Apr 28 13:49:13 serv90514217 nginx[360467]: nginx: configuration file /etc/nginx/nginx.conf test failed
Apr 28 13:49:13 serv90514217 systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Apr 28 13:49:13 serv90514217 systemd[1]: nginx.service: Failed with result 'exit-code'.
Apr 28 13:49:13 serv90514217 systemd[1]: Failed to start A high performance web server and a reverse proxy server.

What is wrong?
Thank you!

Hello! In your config file (proxy-https-to-http.conf) the address should be typed in without “http://” because that part is already specified later in the config. In your case it should look like this:

upstream docservice {
server localhost:5000;
}

Helo,
I have now change and delete the “http://”, but after restart nginx also an error occured:

`● nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Thu 2022-04-28 15:30:26 CEST; 18s ago
       Docs: man:nginx(8)
    Process: 365060 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)

Apr 28 15:30:26 serv90514217 systemd[1]: Starting A high performance web server and a reverse proxy server...
Apr 28 15:30:26 serv90514217 nginx[365060]: nginx: [warn] the "ssl" directive is deprecated, use the "listen ... ssl" directive instead in /etc/nginx/conf.d/proxy-https-to-http.conf:50
Apr 28 15:30:26 serv90514217 nginx[365060]: nginx: [emerg] a duplicate default server for [::]:80 in /etc/nginx/sites-enabled/default:23
Apr 28 15:30:26 serv90514217 nginx[365060]: nginx: configuration file /etc/nginx/nginx.conf test failed
Apr 28 15:30:26 serv90514217 systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Apr 28 15:30:26 serv90514217 systemd[1]: nginx.service: Failed with result 'exit-code'.
Apr 28 15:30:26 serv90514217 systemd[1]: Failed to start A high performance web server and a reverse proxy server.`

Hello,
This output contains an explanation of where exactly the reason of the issue is. There can be only one default_server, so you have to remove this directive from other configs.