Connecting Collabora Online built-in CODE Server with Nginx

When you are using a Nginx server, you need to do a small modification to your existing configuration. For the Collabora Online app to work, you have to add a ‘richdocumentscode/proxy’ entry point as an allowed location to the config in the webroot of your nginx installation. From the documentation at Nextcloud:

location ~ ^\/nextcloud\/(?:index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode\/proxy)\.php(?:$|\/) {

If you experience any problems, of have any questions, pls do contact us.

26 thoughts to “Connecting Collabora Online built-in CODE Server with Nginx”

  1. I have changed the line in the config file from:

    location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+)\.php(?:$|/) {

    to

    location ~ ^\/nextcloud\/(?:index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode\/proxy)\.php(?:$|\/) {

    Rebooted the server then re-enabled the built-in CODE in settings where it then says ‘ Collabora Online server is reachable.’ But I am unable to open any documents. It just throws up the error Collabora could not be reached, try again later

  2. Hi Luke San
    We are sorry about this; but trying to improve the experience there.
    Usually the non-working Built-in CODE server is down to one of these:
    * not installed fontconfig
    * missing FUSE support
    What is the server you are running? Can you try to install fontconfig
    & fuse, and restart nginx?
    Since you are running nginx, it would be also good to restart php-fpm.

    Please let us know if it helped! The thread where this is being
    discussed is here:

    https://github.com/CollaboraOnline/richdocumentscode/issues/26

    1. Thank you for the quick reply,
      I have checked and both fontconfig and fuse are installed.
      Im running on Ubuntu 18.04 Server following the C Reiger install over a year ago.

      CODE server says its connected but just unable to load when i try

      1. C. Rieger recently updated his guide: https://www.c-rieger.de/nextcloud-installationsanleitung/
        so you will need do insert:

        location ~ ^\/(?:index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode\/proxy)\.php(?:$|\/) {
        fastcgi_split_path_info ^(.+?.php)(\/.*|)$;
        set $path_info $fastcgi_path_info;
        try_files $fastcgi_script_name =404;
        include fastcgi_params;
        include php_optimization.conf;
        }

        into your /ets/nginx/conf.d/nextcloud.conf

    2. In my case help this:
      location ~ ^(?:index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode\/proxy)\.php(?:$|\/) {

  3. I’m a bit confused about which file to change here.. Could you please point me in the right direction? I’m running Unraid 6.8.3 with Nextcloud 19 in a docker container (linuxserver/nextcloud package). NginxProxyManager (again Docker) is on reverse proxy duties and MariaDB (as a Docker container as well) is the database backend.
    So which config file should I look at and where to find it?

    All the best

    1. Hi Azat,
      Sorry for the late handling of your comment..!
      If _if_ the problem still exists, pls send a mail with as much as info as possible to hello @
      Thanks & again my appoligies,

      Cor

  4. Hi, I setup nextcloud 19.0.4 and latest richdocumentscode_arm64 (6.x).
    In nextcloud Collabora Online setting:

    Could not establish connection to the Collabora Online server. This might be due to a missing configuration of your web server. For more information, please visit: Connecting Collabora Online Single Click with Nginx

    Use the built-in CODE – Collabora Online Development Edition

    the Collabora_Online.AppImage can be start manually. there is nothing related log in nginx/error.log

  5. In case you use the ARM64 CODE at System like Raspi, you need to use the following line for nginx:
    location ~ ^\/(?:index|apc|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode\/proxy|.+\/richdocumentscode_arm64\/proxy|)\.php(?:$|\/) {

    The original works only with the x86 CODE as it seems, just to save you some time in the future.

  6. I am using a shared web-hoster service and have no access to /ets/nginx/conf.d
    How can I make the Collabora CODE Server work?

  7. For now, I tried it on fresh CentOS8 install, with fresh Nextcloud 20.0.4 install with Nginx, Collabora Online with integrated CODE Server, and it does NOT work. I tried everything suggested in this thread, no change at all. Not even an error message in the logs, nothing. It just says could not connect to Collabora online server and a link to this page. That’s all.
    The next side-effect is, that Nextcloud UI gets extremely slow, every click takes about 2-5min. to process. Working with it is impossible. Disabling the Collabora App in Nextcloud makes the server blasing fast again.
    Any useful ideas anyone?!

  8. Hi

    I’m using Nextcloud on an Ubuntu VServer with Plesk and nginx but I don’t know where to add the richdocumentscode/proxy’ entry point.
    Hope you can help me explaining where to add this snippet.
    Tried to reinstall collaboraoffice and the built-in coe server, but it still doesn’t work.

    Thank you and greetings
    Phil

  9. If you run richdoumentscode on ARM64 (richdoumentscode_arm64 package), you have to change richdocumentscode\/proxy to richdocumentscode_arm64\/proxy in NGINX settings.

    My working example:
    location ~ \.php(?:$|/) {
    # Required for legacy support
    rewrite ^/(?!index|remote|public|cron|core\/ajax\/update|status|oc[ms]\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode_arm64\/proxy) /index.php$request_uri;

    fastcgi_split_path_info ^(.+?\.php)(/.*)$;
    set $path_info $fastcgi_path_info;

    try_files $fastcgi_script_name =404;

    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param PATH_INFO $path_info;
    fastcgi_param HTTPS on;

    fastcgi_param modHeadersAvailable true; # Avoid sending the security headers twice
    fastcgi_param front_controller_active true; # Enable pretty urls
    fastcgi_pass php-handler;

    fastcgi_intercept_errors on;
    fastcgi_request_buffering off;

    fastcgi_max_temp_file_size 0;
    }

    1. “[…] you have to change richdocumentscode\/proxy to richdocumentscode_arm64\/proxy in NGINX settings.”

      Thank you so much! After years of struggling with getting this to work, this small little invaluable hint got it working for me! Finally!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.