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.
- Install docker in Ubuntu 16.04 amd64 :
$ sudo apt-get update $ sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ software-properties-common $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - $ sudo add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable" $ 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/mod_authn_core.so LoadModule authz_core_module modules/mod_authz_core.so LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_http_module modules/mod_proxy_http.so LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so LoadModule headers_module modules/mod_headers.so LoadModule setenvif_module modules/mod_setenvif.so LoadModule ssl_module modules/mod_ssl.so <IfModule unixd_module> User seafile // replace with your seafile user Group seafile // replace with your seafile group </IfModule> <VirtualHost *:80> ServerName server.fr // replace "server.fr" with your server URL ServerAlias seafile Redirect permanent / https://server.fr/ </VirtualHost> <VirtualHost *:443> ServerName server.fr DocumentRoot /var/www SSLEngine On Include /etc/letsencrypt/options-ssl-apache.conf SSLCertificateFile /etc/letsencrypt/live/server.fr/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/server.fr/privkey.pem Alias /media /haiwen/seafile-server-latest/seahub/media <Location /media> Require all granted </Location> RewriteEngine On ProxyPass /seafhttp http://127.0.0.1:8082 ProxyPassReverse /seafhttp http://127.0.0.1:8082 RewriteRule ^/seafhttp - [QSA,L] SetEnvIf Request_URI . proxy-fcgi-pathinfo=unescape SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1 ProxyPass / http://127.0.0.1:8000/ ProxyPassReverse / http://127.0.0.1:8000/ ProxyPass / fcgi://127.0.0.1:8000/ Define VPATH /onlyofficeds Define DS_ADDRESS server.fr:88 <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}/" </Location> </VirtualHost>
-
Configure Seafile Server for SUBFOLDER :
Add the following config option toseahub_settings.py
:
# Enable Only Office
ENABLE_ONLYOFFICE = True
VERIFY_ONLYOFFICE_CERTIFICATE = True
ONLYOFFICE_APIJS_URL = 'https://server.fr/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')
Then restart the Seafile Server.