群晖安装OnlyOffice
1、拉取镜像
ssh admin@201.201.201.168
cd /volume1/docker
sudo docker pull onlyoffice/documentserver
2、安装onlyoffice,注意配置端口
本地端口与已用的不冲突即可
3、关闭密钥
否则每次都提示文档安全令牌有问题
参考资料:
4、保存一个HTML(view.html),供外部调用(不是必须,如果不需要外部调用,可以不理会)
注意修改里面的路径,路径就是上文配置的IP及端口
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>OnlyOffice Viewer</title> </head> <body> <div id="placeholder"></div> <script type="text/javascript" src="http://201.201.201.168:9080/web-apps/apps/api/documents/api.js"></script> <script> function getQueryParamValue(name) { const searchParams = new URLSearchParams(window.location.search); return searchParams.get(name); } const url = decodeURIComponent(getQueryParamValue("src")); const fileName = url.substring(url.lastIndexOf('/') + 1, url.lastIndexOf('?') != -1 ? url.lastIndexOf('?') : url.length); const fileExtension = fileName.split('.').pop(); const docEditor = new DocsAPI.DocEditor("placeholder", { "document": { "fileType": fileExtension, "permissions": { "edit": false, "comment": false, "download": true, "print": true, "fillForms": true, }, "title": fileName, "url": url, }, "editorConfig": { "lang": "zh-CN", "mode": "view", }, "height": "1080px", "type": "desktop", }); </script> </body> </html>
参考资料:
https://blog.csdn.net/stars_moon1024/article/details/131550134