Deploying OnlyOffice containers for NextCloud
This article was last updated 149 days ago. The information in it may have developed or changed. If it is invalid, please leave a message in the comment section.

Deploy redis container

To deploy the onlyoffice container for nextcloud, you first need to deploy the redis container:

docker run --name redis -d --restart=always --net=public-net -p 6379:6379 redis

Creating a bridge

It's recommended to develop good habits: when deploying containers, regardless of whether they are actually used, it's best to include the `--net` parameter and use the same predefined, non-default bridge. This makes it easier to call the container by its name when needed. Because we'll be using a bridge named `public-net` below, it needs to be created beforehand.

docker network create public-net

Deploy onlyoffice container

The command is as follows

docker run --name onlyoffice -d --restart=always --net=public-net \ -p 9020:80 \ -p 9023:443 \ -e JWT_SECRET=xxxxxxxxxxxxxxx \ -e REDIS_SERVER_HOST=redis \ -e REDIS_SERVER_PORT=6379 \ -v /docker/onlyoffice/logs:/var/log/onlyoffice \ -v /docker/onlyoffice/data:/var/www/onlyoffice/Data \ -v /docker/onlyoffice/lib:/var/lib/onlyoffice \ -v /docker/onlyoffice/db:/var/lib/postgresql \ -v /docker/onlyoffice/redis:/var/lib/redis \ onlyoffice/documentserver

Parameter explanation:
-p 9020:80 -p 9023:443
Ports 9020 and 9023 correspond to ports 80 and 443 inside the container respectively. You can adjust them according to your actual deployment environment.
-e JWT_SECRET
It specifies a fixed secret. If this environment variable is not specified, the secret will be regenerated every time Docker is restarted, and an error will be reported:

image.png

Then you need to go to the following locations in the onlyoffice container to view:

cat etc/onlyoffice/documentserver/local.json
secret": { "inbox": { "string": "YOURTOKEN" }, "outbox": { "string": "YOURTOKEN" }, "session": { "string": "YOURTOKEN" }

This is very inconvenient, and it is strongly recommended that you specify a fixed value yourself.
-e REDIS_SERVER_HOST=redis
-e REDIS_SERVER_PORT=6379
Specify the address and port of the Redis server. Since Redis and OnlyOffice belong to the same non-default bridge "public-net", they can communicate directly using the container name. Otherwise, the --link parameter is required.


Note: When you build a container environment, it is recommended that you plan the location of all container mount folders in advance. I put all container mount folders in the /docker folder, and then one folder for each container, such as /docker/onlyoffice/, and then the mount folder corresponding to this container. Developing good habits will make later maintenance more convenient, and when migrating to a new container environment and recreating the corresponding container, you don’t even have to change the mount path, which is very cool.


After the onlyoffice container is deployed, the example is not enabled by default. You need to execute:

docker exec onlyoffice sudo supervisorctl start ds:example

Then you can access:http://xxxx:9020:example
Assume that xxxx is the intranet IP address of your container host. The page is as follows:

image.png

If you want this page to start automatically every time you restart the container, you need to execute:

docker exec onlyoffice sudo sed 's,autostart=false,autostart=true,' -i /etc/supervisor/conf.d/ds-example.conf

Configure nextcloud

The next step is to configure in nextcloud (onlyoffice plug-in needs to be installed in advance):

image.png

The situation here is more complicated, and it is divided into two mainstream situations, depending on whether the client is accessed purely from the intranet or needs to be accessed from the external network, and whether it is divided into http mode or https mode:

1. Both nextcloud and onlyoffice are only in the intranet and the client browser accesses them using HTTP

If you are accessing HTTP in the intranet, then it is easiest to fill in the "ONLYOFFICE Docs address for internal server" option under More settings in the lower right corner of the above picture:http://x.x.x.x:9020 Specify the intranet IP or domain name of onlyoffice in the same way, and then fill in the "Address of the server used for ONLYOFFICE Docs internal requests" option:http://x.x.x.x:9010You can specify the intranet IP or intranet domain name of nextcloud (assuming 9010 is the port mapped by the host of nextcloud).

2. Both nextcloud and onlyoffice are deployed on the public Internet and the client browser accesses them using https

If this is the case, and onlyoffice can open the example page normally through the public domain name, you only need to fill in the onlyoffice corresponding to the first red box "ONLYOFFICE Docs" in the upper right corner of the above picture.https://public domain name , and then fill in the "Key" below with the secret you customized when you created the container earlier.

Note: NextCloud uses HTTPS for access, so OnlyOffice must also be configured with HTTPS, so port 9023 will be mapped when the OnlyOffice container is created. If OnlyOffice is used with reverse proxy, the reverse proxy of the public domain name corresponding to OnlyOffice needs to use HTTPS and point to the HTTPS port when specifying the upstream server target URL. In this example, it points tohttps://x.x.x.x:9023.

When creating the onlyoffice container, we mounted the following directories with -v:
-v /docker/onlyoffice/data:/var/www/onlyoffice/Data

The data directory is used to store the SSL certificate corresponding to the onlyoffice public domain name. Create a certs directory in data, then rename the SSL certificate (crt, key) corresponding to the onlyoffice domain name to onlyoffice.crt and onlyoffice.key, put them in this directory and restart the onlyoffice container.

After saving, if the following content appears on the OnlyOffice page of NextCloud, it is successful:

image.png

This method can complete the deployment of NextCloud and OnlyOffice in the same container environment. There is no need to set up a server with a public IP address to build the OnlyOffice container like some netizens do. In short, just set up OnlyOffice and NextCloud containers in an intranet environment at the same time, and then make corresponding configurations on the export.

In addition, there may be many different deployment scenarios. For example, nextcloud and onlyoffice are respectively in the intranet, public network, and behind the reverse proxy. You can analyze and handle them according to the actual situation.

📌 Content Structure Hints:
This content belongs to "Blog Knowledge MapThis is part of the document; you can view the full content path here: Blog Knowledge Map .
Share this article
All blog content is original; please indicate the source when reprinting! The blog's RSS address is:https://blog.tangwudi.com/feed, welcome to subscribe; if necessary, you can joinTelegram GroupDiscuss the problem together.
No Comments

Send Comment Edit Comment


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠(ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ°Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
Emoticons
Emoji
Little Dinosaur
flower!
Previous
Next