Page 1 of 1

Issues with Reverse Proxy

Posted: Wed Apr 24, 2019 7:45 pm
by c0fe
I am trying to integrate OnlyOffice with Nextcloud (version 15) but I am running into issues.

I have a setup in which I have NextCloud and Onlyoffice running on two local servers behind an NGiNX reverse proxy that handles SSL termination. So the setup is:


I have pulled the documentation from here: ... proxy.aspx

But I am getting issues with using the site configuration:

Code: Select all

# Use this example for proxy HTTPS traffic to the document server running at 'backendserver-address'.
# Replace {{SSL_CERTIFICATE_PATH}} with the path to the ssl certificate file
# Replace {{SSL_KEY_PATH}} with the path to the ssl private key file

upstream docservice {

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

  ## Redirects all traffic to the HTTPS host
  root /nowhere; ## root doesn't have to be a valid path since we are redirecting
  rewrite ^ https://$host$request_uri? permanent;

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

  ## Strong SSL Security
  ssl on;
  ssl_certificate /etc/letsencrypt/live/;
  ssl_certificate_key /etc/letsencrypt/live/;
  ssl_verify_client off;


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

  ssl_prefer_server_ciphers   on;

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

  ## [Optional] If your certficate has OCSP, enable OCSP stapling to reduce the overhead and latency of running SSL.
  ## Replace with your ssl_trusted_certificate. For more info see:
  ## -
  ## -
  ## -
  # ssl_stapling on;
  # ssl_stapling_verify on;
  # ssl_trusted_certificate /etc/nginx/ssl/stapling.trusted.crt;
  # resolver valid=300s; # Can change to your DNS resolver if desired
  # resolver_timeout 10s;

  ## [Optional] Generate a stronger DHE parameter:
  ##   cd /etc/ssl/certs
  ##   sudo openssl dhparam -out dhparam.pem 4096
  # ssl_dhparam /etc/ssl/certs/dhparam.pem;

  location / {
    proxy_pass http://docservice;
    proxy_http_version 1.1;
When I use this site configuration the domain "" resolves to my default website which in this case is my Nextcloud server. What am I not understanding?

Re: Issues with Reverse Proxy

Posted: Sun Aug 04, 2019 7:04 pm
by Maxim
Hello c0fe!
I hope you have solved your issue. Is it actual to solve this issue for you now?