Seafile with OnlyOffice in a Subfolder


I am trying to install a basic Seafile instance on an AWS EC2 instance, but having trouble with OnlyOffice integration.

I have tried following the Seafile Manual Instructions, but quickly run into difficulty.

Since I only have the one VPS, I would like to run Seafile and OnlyOffice on the same machine. Thed Seafile Manual recommends that “Seafile should be deployed at the root URL while OnlyOffice should be deployed using a subfolder URL.” [Sorry, the forum does not allow links]

I can install Seafile fine, using the script method. It all works great, but obviously no OnlyOffice integration.

If I then try installing OnlyOffice via Docker with:

sudo docker run -i -t -d -p 80:80 onlyoffice/documentserver

… I receive the error:

docker: Error response from daemon: driver failed programming external connectivity on endpoint infallible_almeida (7a307173b7d0be441480e026e69d508b0cf0632396dfca366914bca81b1d463b): Error starting userland proxy: listen tcp4 bind: address already in use.

This suggests an address conflict, which makes sense: the OnlyOffice installation doesn’t yet know it needs to operate in a subfolder.

So I then try:

docker run -dit -p --restart always --name onlyofficeds onlyoffice/documentserver

This works successfully without error.

I then return to the Manual, which suggests configuring /etc/ngnix/conf.d/seafile.conf to remap the variables. There is no seafile.conf in the /etc/ngnix/conf.d/seafile.conf folder, but there is one in the site-enabled subfolder.

The Manual recommends adding the following outside the server directive:

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;
"" $host;

map $http_upgrade $proxy_connection {
default upgrade;
"" close;

… and adding the following inside the server directive:

location /onlyofficeds/ {
proxy_http_version 1.1;
client_max_body_size 100M; # Limit Document size to 100MB
proxy_read_timeout 3600s;
proxy_connect_timeout 3600s;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $proxy_connection;

# THIS ONE IS IMPORTANT ! - Subfolder and NO trailing slash !
proxy_set_header X-Forwarded-Host $the_host/onlyofficeds;

proxy_set_header X-Forwarded-Proto $the_scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for

The Manual recommends restarting thE Seafile server then visiting http{s}://{your Seafile Server's domain or IP}/{your subfolder}/welcome to test that the process has been successful. In my case, it is not. The request times out every time. Restarting Nginx makes no difference either.

The Manual then recommends adding the following config option to

ENABLE_ONLYOFFICE = True VERIFY_ONLYOFFICE_CERTIFICATE = True ONLYOFFICE_APIJS_URL = 'http{s}://{your Seafile server's domain or IP}/{your subdolder}/web-apps/apps/api/documents/api.js' ONLYOFFICE_FILE_EXTENSION = ('doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx', 'odt', 'fodt', 'odp', 'fodp', 'ods', 'fods') ONLYOFFICE_EDIT_FILE_EXTENSION = ('docx', 'pptx', 'xlsx')

Having done this, I get the same issue: attemping to open a document from the Seafile web interface simply times out rather than failing.

What am I doing wrong?

Gentle bump. This really has me stuck and I can’t way a way around it. Any help very much appreciated.