LOOL on Ubuntu 22.04 with nginx reverseproxy and certbot

Based on this Post by Xiao Guoan on LinuxBabe

 Dependencies: 
sudo apt install apt-transport-https ca-certificates snapd
Add Repository:
cd /usr/share/keyrings
sudo wget https://collaboraoffice.com/downloads/gpg/collaboraonline-release-keyring.gpg
echo 'deb https://www.collaboraoffice.com/repos/CollaboraOnline/CODE-ubuntu2204 ./' | sudo tee /etc/apt/sources.list.d/collabora.list
Install:
sudo apt update
sudo apt install coolwsd code-brand nginx
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot
Setup LOOL:
sudo coolconfig set ssl.enable false
sudo coolconfig set ssl.termination true
sudo coolconfig set storage.wopi.host nextcloud.example.com
sudo coolconfig set-admin-password
sudo systemctl restart coolwsd
Setup nginx:
sudo nano /etc/nginx/conf.d/collabora.conf

insert:

server {
    listen 80;
    listen [::]:80;
    server_name  collabora.example.com;

    error_log /var/log/nginx/collabora.error;

   # static files
    location ^~ /browser {
        proxy_pass http://localhost:9980;
        proxy_set_header Host $http_host;
    }
    location ^~ /loleaflet {
        proxy_pass http://localhost:9980;
        proxy_set_header Host $http_host;
    }


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

    # Capabilities
    location ^~ /hosting/capabilities {
        proxy_pass http://localhost:9980;
        proxy_set_header Host $http_host;
    }

    # main websocket
    location ~ ^/cool/(.*)/ws$ {
        proxy_pass http://localhost:9980;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_set_header Host $http_host;
        proxy_read_timeout 36000s;
    }

    # download, presentation and image upload
    location ~ ^/(c|l)ool {
        proxy_pass http://localhost:9980;
        proxy_set_header Host $http_host;
    }

    # Admin Console websocket
    location ^~ /cool/adminws {
        proxy_pass http://localhost:9980;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_set_header Host $http_host;
        proxy_read_timeout 36000s;
    }
}

check config for errors:

sudo nginx -t

reload nginx:

sudo systemctl reload nginx
Certbot:
sudo certbot --apache --agree-tos --redirect --hsts --staple-ocsp --email you@example.com -d collabora.example.com
Usefull Infos:

Adminconsole LOOL:

domain/browser/dist/admin/admin.html

LOOL Logs:

sudo journalctl -eu coolwsd

NGINX Logs:

/var/log/nginx/collabora.error

Updates:

If after apt update && apt upgrade you are asked wich config to use - if you use the new one, you have to do LOOL-Setup Steps again.

This article was updated on 27 Juli 2023