How To install Onlyoffice in Seafile with Apache on ubuntu

For those who want to run Onlyoffice in Seafile under Apache web server on Ubuntu 16.04, I share the correct and complet How To.

I suppose you already have a seafile server running by following server manual.

$ sudo apt-get update

$ sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \

$ curl -fsSL | sudo apt-key add -

$ sudo add-apt-repository \
   "deb [arch=amd64] \
   $(lsb_release -cs) \

$ sudo apt-get update

$ sudo apt-get install docker-ce

  • Deploy OnlyOffice DocumentServer Docker image :

docker run -dit -p 88:80 --restart always --name oods onlyoffice/documentserver
  • Configure Apache :

LoadModule authn_core_module modules/
LoadModule authz_core_module modules/
LoadModule proxy_module modules/
LoadModule proxy_http_module modules/
LoadModule proxy_wstunnel_module modules/
LoadModule headers_module modules/
LoadModule setenvif_module modules/
LoadModule ssl_module modules/

<IfModule unixd_module>
  User seafile           // replace with your seafile user
  Group seafile          // replace with your seafile group

<VirtualHost *:80>
   ServerName  // replace "" with your server URL
   ServerAlias seafile
   Redirect permanent /

<VirtualHost *:443>
  DocumentRoot /var/www

  SSLEngine On
  Include /etc/letsencrypt/options-ssl-apache.conf
  SSLCertificateFile /etc/letsencrypt/live/
  SSLCertificateKeyFile /etc/letsencrypt/live/

  Alias /media /haiwen/seafile-server-latest/seahub/media

  <Location /media>
    Require all granted

  RewriteEngine On
  ProxyPass /seafhttp
  ProxyPassReverse /seafhttp

  RewriteRule ^/seafhttp - [QSA,L]
  SetEnvIf Request_URI . proxy-fcgi-pathinfo=unescape
  SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1

  ProxyPass /
  ProxyPassReverse /
  ProxyPass / fcgi://

Define VPATH /onlyofficeds

<Location ${VPATH}>
Require all granted
  SetEnvIf Host "^(.*)$" THE_HOST=$1
  RequestHeader setifempty X-Forwarded-Proto https   // https VERY important !
  RequestHeader setifempty X-Forwarded-Host %{THE_HOST}e
  RequestHeader edit X-Forwarded-Host (.*) $1${VPATH}
  ProxyAddHeaders Off
  ProxyPass "http://${DS_ADDRESS}/"
  ProxyPassReverse "http://${DS_ADDRESS}/"

  • Configure Seafile Server for SUBFOLDER :
    Add the following config option to

# Enable Only Office
ONLYOFFICE_FILE_EXTENSION = ('doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx', 'odt', 'fodt', 'odp', 'fodp', 'ods', 'fods')
ONLYOFFICE_EDIT_FILE_EXTENSION = ('docx', 'pptx', 'xlsx')

Then restart the Seafile Server.