502 Error with Collabora on Nginx


#1

I followed @icewind s guide for configuring collabora on nginx, but when attempting to load a new or existing file in Collabora Office I receive the following error:

Collabora Online unknown error: Server error
response [url] https://my.domain.com/hosting/discovery [status
code] 502 [reason phrase] Bad Gateway

For the docker installation I am using the same SSL domain that nextcloud is currently configured on.

I added the suggested location entries to the pre-existing nginx config.

After installing the app I set the online server to https:// my. domain. com. I tried adding :443 to the end and get the same message. I tried :9980 and received the > cURL error 7 message @offerlam received.

I assume that means that I’m setting the online server appropriately.

Only error in the log is Undefined index: dir at /var/www/apps/richdocuments/controller/documentcontroller.php#289

What am I missing?


#2

Note: I had to enter spaces to avoid topping the url limit.


#3

I had the problem that my nextcloud server was behind a edge firewall. I hadn’t NATed the ports 9980 to my nextcloud - only 443 since thats uses for the clients and web access…

if you nextcloud server is not directly exposed to the internet, check that you are natting aswell… also make sure if you have a local firewall on the server, that its not blocking anything…

could you also post you .conf file for the webserver?


#4

@offerlam after reading through your issue I port forwarded 9980 to be safe. Same thing. I never configured a firewall, so I don’t imagine that being the issue.

If it means anything, I’m running of an ARM based Rasperry Pi. I didn’t receive any error when configuring the docker installation.

upstream php-handler {
  server 127.0.0.1:9000;
  #server unix:/var/run/php5-fpm.sock;
}
server {
    listen 80;
    return 301 https://$host$request_uri;
}

server {
  listen 443 ssl;
  server_name my.domain.net;
  add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";
  access_log /var/log/nginx/sitename.access.log;
  error_log /var/log/nginx/sitename.error.log;

  ssl_certificate /etc/letsencrypt/live/my.domain.net/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/my.domain.net/privkey.pem;

  # Path to the root of your installation
  root /var/www;
  client_max_body_size 10G; # set max upload size
  fastcgi_buffers 64 4K;

# Some rewrite rules, more to come later
  rewrite ^/caldav((/|$).*)$ /remote.php/caldav$1 last;
  rewrite ^/carddav((/|$).*)$ /remote.php/carddav$1 last;
  rewrite ^/webdav((/|$).*)$ /remote.php/webdav$1 last;

  # Protecting sensitive files from the evil outside world
  location ~ ^/(data|config|\.ht|db_structure.xml|README) {
           deny all;
  }
  # Configure the root location with proper rewrite rules
  location / {
           rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
           rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;
           rewrite ^/.well-known/carddav /remote.php/carddav/ redirect;
           rewrite ^/.well-known/caldav /remote.php/caldav/ redirect;
           rewrite ^/apps/calendar/caldav.php /remote.php/caldav/ last;
           rewrite ^/apps/contacts/carddav.php /remote.php/carddav/ last;
           rewrite ^/apps/([^/]*)/(.*\.(css|php))$ /index.php?app=$1&getfile=$2 last;
           rewrite ^(/core/doc[^\/]+/)$ $1/index.html;
           try_files $uri $uri/ index.php;
 }
location ~ \.php(?:$|/) {
  fastcgi_split_path_info ^(.+\.php)(/.+)$;
  include fastcgi_params;
  fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  fastcgi_param PATH_INFO $fastcgi_path_info;
  fastcgi_param HTTPS on;
  fastcgi_pass unix:/var/run/php5-fpm.sock;
  fastcgi_param htaccessWorking true;
  fastcgi_read_timeout 360000;
 }

location ^~ /.well-known/acme-challenge/ {

        allow all;
       }

    # docker CODE static files
    location ^~ /loleaflet {
        proxy_pass https://localhost:9980;
        proxy_set_header Host $http_host;
    }

    # docker CODE WOPI discovery URL
    location ^~ /hosting/discovery {
        proxy_pass https://localhost:9980;
        proxy_set_header Host $http_host;
    }

    # docker CODE websockets, download, presentation and image upload
    location ^~ /lool {
        proxy_pass https://localhost:9980;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $http_host;
    }


# Optional: set long EXPIRES header on static assets
location ~* \.(?:jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ {
expires 30d;
# Optional: Don't log access to assets
access_log off;
 }
}

#5

regarding your conf file

im using apache…

but when im compare yours to mine mine is different in the servername… you servername is my.domain.net which i assume is your nextcloud domain name… i use the office domain you have to create. so my servername is office.dingit.dk not data.dingit.dk


#6

Okay, I’ll try running the process over again but with a different servername. The nginx directions I followed seemed to suggest that it could be done either way, though. Any thoughts @icewind?


#7

When I run docker run collabora/code I get

standard_init_linux.go:175: exec user process caused “exec format error”

I’m thinking that this is an issue with the Raspberry Pi’s ARM processor… The container isn’t even runnning. Damn. Possible to run outside of docker maybe?


#8

regarding not using the docker method.

The installation of collabora is vary difficult in my perspektive. which is also why they made the docker solution. so ofcause you can get collabora working on nextcloud not using docker. Its just hard… not something i know anything about :slight_smile:


#9

Looks like I’ll be digging-in soon! We’ll see.


#10

good luck! fingers crossed


#11

I think the problem is the arm architecture. The docker image is build for the x86 architecture and can’t run on a arm processor. Also copying everything out of the docker container wouldn’t help, it is still the wrong processor architecture. Only compiling everything for arm could help.


#12

Ohh… I had thought it was the format of the docker container itself that was the issue. That makes sense, though.

Thanks for the heads up @egon.


#13

Ouch! I’m on a Pine64 (aarch64) and it cannot even start the docker

docker: Error response from daemon: rpc error: code = 2 desc = “oci runtime error: exec format error”.

So, I also think docker image does not run on ARM…


#14

Seems so that you cannot run collabora on a ARM device like Rasperry Pi.

See: https://help.nextcloud.com/t/collabora-install-in-raspberrypi-3-problem/10183


#15

I think a found some lead. Collabora/code docker container is crashing since the STATUS uptime is always less than a second up and then it the up time resets to Up 1 seconds…

sudo docker ps                                                                                                                                                    
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                      NAMES 
ff7bb05494f4        collabora/code      "/bin/sh -c 'bash ..."   12 hours ago        Up 34 seconds       127.0.0.1:9980->9980/tcp   peaceful_haibt 
5a0be9cc3e04        mquandalle/wekan    "/bin/sh -c 'bash ..."   14 months ago       Up 2 months         0.0.0.0:8081->80/tcp       wekan_wekan_1 
02cf142a5f3c        mongo               "/entrypoint.sh mo..."   14 months ago       Up 2 months         27017/tcp                  wekan_wekandb_1   

I’m using Docker version 17.05.0-ce.

In my case I think it’s not related to wrong Nginx configuration, but more about a instable docker image of collabora. If I join the container (docker exec -i -t ff7bb05494f4 /bin/bash). I will get kicked-out after some seconds because it’s crashing :cry:

EDIT:

There is already a topic about my problem, see: