NextCloud and OnlyOffice via Docker: Difference between revisions
From WikiMLT
m (→Install Docker) |
m (→References) |
||
Line 1: | Line 1: | ||
<noinclude><!--[[Category:Linux_Server|?]]-->{{ContentArticleHeader/Linux_Server}}</noinclude> | <noinclude><!--[[Category:Linux_Server|?]]-->{{ContentArticleHeader/Linux_Server}}</noinclude> | ||
Here is a short step-by-step manual: | Here is a short step-by-step manual: '''How to setup OnlyOffice Docker container and proxy it by Apache2 for NextCloud usage.''' | ||
'''How | |||
== Install Docker == | == Install Docker == | ||
{{collapse/begin}} | {{collapse/begin}} | ||
According to the Docker installation, read the guide [[Docker Basic Setup]]. The following part of this section is deprecated, but is leaved here as historical note :) | According to the Docker installation, read the guide [[Docker Basic Setup]]. The following part of this section is deprecated, but is leaved here as historical note :) | ||
{{collapse/div|#Deprecated Section}} | {{collapse/div|#Remove me: Deprecated Section}} | ||
<syntaxhighlight lang="shell" line="1"> | <syntaxhighlight lang="shell" line="1"> | ||
sudo apt update | sudo apt update | ||
Line 35: | Line 33: | ||
== Install latest OnlyOffice == | == Install latest OnlyOffice == | ||
{{collapse/begin}} | |||
The rest part of this section is deprecated, but is leaved here as historical note :) | |||
{{collapse/div|#Remove me: Deprecated Section}} | |||
Get a list of all available versions of OnlyOffice images ([https://stackoverflow.com/a/42879158/6543935 reference]).<syntaxhighlight lang="shell" line="1"> | Get a list of all available versions of OnlyOffice images ([https://stackoverflow.com/a/42879158/6543935 reference]).<syntaxhighlight lang="shell" line="1"> | ||
wget -q https://registry.hub.docker.com/v1/repositories/onlyoffice/documentserver/tags -O - | jq -r '.[].name' | wget -q https://registry.hub.docker.com/v1/repositories/onlyoffice/documentserver/tags -O - | jq -r '.[].name' | ||
Line 44: | Line 45: | ||
* Note the option <code>--restart=always</code> means the container will run automatically when Docker is started/restarted. | * Note the option <code>--restart=always</code> means the container will run automatically when Docker is started/restarted. | ||
* Docker will pull the image automatically when it is not available locally. | * Docker will pull the image automatically when it is not available locally. | ||
{{collapse/end}} | |||
== Apache2 Proxy Virtual Host == | == Apache2 Proxy Virtual Host == | ||
Test Whether the cesessary Apache2 modules are enabled.<syntaxhighlight lang="shell" line="1"> | Test Whether the cesessary Apache2 modules are enabled.<syntaxhighlight lang="shell" line="1"> | ||
Line 108: | Line 109: | ||
== References == | == References == | ||
* [https://helpcenter.onlyoffice.com/installation/docs-community-install-docker.aspx#Installing | * OnlyOffice Help Center: [https://helpcenter.onlyoffice.com/installation/docs-community-install-docker.aspx#Installing Installing ONLYOFFICE Docs Community Edition for Docker on a local server] | ||
* [https://hub.docker.com/r/onlyoffice/documentserver | * Docker Hub: [https://hub.docker.com/r/onlyoffice/documentserver onlyoffice/documentserver] | ||
* [https://github.com/ONLYOFFICE/onlyoffice-nextcloud | * GitHub: [https://github.com/ONLYOFFICE/onlyoffice-nextcloud ONLYOFFICE/onlyoffice-nextcloud] | ||
* [https://github.com/ONLYOFFICE/onlyoffice-nextcloud/releases | * GitHub: [https://github.com/ONLYOFFICE/onlyoffice-nextcloud/releases ONLYOFFICE/onlyoffice-nextcloud/releases] | ||
* [https://api.onlyoffice.com/editors/nextcloud | * OnlyOffice Api Docs: [https://api.onlyoffice.com/editors/nextcloud Nextcloud ONLYOFFICE integration app] | ||
* [https://github.com/ONLYOFFICE/onlyoffice-nextcloud/issues/297 <nowiki> | * GitHub: [https://github.com/ONLYOFFICE/onlyoffice-nextcloud/issues/297 <nowiki>ONLYOFFICE/onlyoffice-nextcloud/issues/[Can't connect do document server after update to NC19 #297]</nowiki>] | ||
* [https://phoenixnap.com/kb/install-docker-on-ubuntu-20-04 | * PhoenixNAP: [https://phoenixnap.com/kb/install-docker-on-ubuntu-20-04 How To Install and Use Docker on Ubuntu 20.04] | ||
<noinclude> | <noinclude> | ||
<div id='devStage'> | <div id='devStage'> |
Revision as of 09:03, 25 September 2022
Here is a short step-by-step manual: How to setup OnlyOffice Docker container and proxy it by Apache2 for NextCloud usage.
Install Docker
According to the Docker installation, read the guide Docker Basic Setup. The following part of this section is deprecated, but is leaved here as historical note :)
#Remove me: Deprecated Section
sudo apt update
sudo apt 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 install docker-ce
docker --version
sudo systemctl start docker
sudo systemctl enable docker
$USER
without using sudo
.sudo groupadd docker
sudo usermod -aG docker $USER
su - $USER
id -nG
sudo crontab -l | grep -i 'docker'
0 2 * * 7 /usr/bin/docker container prune
sudo sed 's/^#DOCKER_OPTS/DOCKER_OPTS/' /etc/default/docker -i
sudo systemctl restart docker
Install latest OnlyOffice
The rest part of this section is deprecated, but is leaved here as historical note :)
#Remove me: Deprecated Section
wget -q https://registry.hub.docker.com/v1/repositories/onlyoffice/documentserver/tags -O - | jq -r '.[].name'
81
of 127.0.0.1 localhost
.# docker pull onlyoffice/documentserver
docker run -i -t -d -p 81:80 --restart=always onlyoffice/documentserver:latest
- Note the option
–restart=always
means the container will run automatically when Docker is started/restarted. - Docker will pull the image automatically when it is not available locally.
Apache2 Proxy Virtual Host
Test Whether the cesessary Apache2 modules are enabled.
sudo apache2ctl -M | grep -E 'auth[nz]_core|unixd|proxy|headers|setenvif'
unixd_module (static) # Required
authn_core_module (shared) # Required
authz_core_module (shared) # Required
headers_module (shared) # Required
proxy_module (shared) # Required
proxy_fcgi_module (shared)
proxy_http_module (shared) # Required
proxy_http2_module (shared)
proxy_wstunnel_module (shared) # Required
setenvif_module (shared) # Required
Setup a new virtual host as follow and restart Apache2. Note in this scenariou you need a valid SSL/TLS certivicate.
sudo nano /etc/apache2/sites-enabled/docs.example.com.conf
<VirtualHost *:80>
ServerName docs.example.com
ServerAdmin admin@example.com
Redirect permanent "/" "https://docs.example.com/"
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerName docs.example.com
ServerAdmin admin@example.com
ErrorLog ${APACHE_LOG_DIR}/docs.example.com.error.log
CustomLog ${APACHE_LOG_DIR}/docs.example.com.access.log combined
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/example.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/example.com/chain.pem
<IfModule pagespeed_module>
ModPagespeed off
</IfModule>
<IfModule security2_module>
# SecRuleEngine Off
</IfModule>
# ProxyPreserveHost On
# ProxyRequests Off
SetEnvIf Host "^(.*)$" THE_HOST=$1
Header edit Set-Cookie ^(.*)$ "$1; HttpOnly; Secure"
RequestHeader setifempty X-Forwarded-Proto https
RequestHeader setifempty X-Forwarded-Host %{THE_HOST}e
ProxyAddHeaders Off
ProxyPassMatch (.*)(\/websocket)$ "ws://localhost:81/$1$2"
ProxyPass / "http://localhost:81/"
ProxyPassReverse / "http://localhost:81/"
</VirtualHost>
</IfModule>
References
- OnlyOffice Help Center: Installing ONLYOFFICE Docs Community Edition for Docker on a local server
- Docker Hub: onlyoffice/documentserver
- GitHub: ONLYOFFICE/onlyoffice-nextcloud
- GitHub: ONLYOFFICE/onlyoffice-nextcloud/releases
- OnlyOffice Api Docs: Nextcloud ONLYOFFICE integration app
- GitHub: ONLYOFFICE/onlyoffice-nextcloud/issues/[Can't connect do document server after update to NC19 #297]
- PhoenixNAP: How To Install and Use Docker on Ubuntu 20.04