您好,登錄后才能下訂單哦!
這篇文章主要介紹了docker如何安裝部署onlyoffice,具有一定借鑒價值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。
0. 系統要求
中央處理器 I5-10400F以上
內存 16 GB,最佳32G內存
硬盤 至少40 GB的可用空間
1:安裝Docker Desktop
2:進入BIOS設置CPU的虛擬化
https://jingyan.baidu.com/article/ab0b56305f2882c15afa7dda.html
3:啟動Docker desktop
報錯解決:https://blog.csdn.net/qq_39611230/article/details/108625840
3:cmd進入,使用命令安裝onlyoffice
安裝通用版:
docker pull hub.c.163.com/gongzh/onlyoffice:latest
運行
docker run -i -t -d -p 8702:80 hub.c.163.com/gongzh/onlyoffice
安裝社區版本【免費】:
docker run -i -t -d -p 8703:80 --restart=always onlyoffice/documentserver
查看容器,輸入docker ps ,
進入容器,docker exec -i -t e15 /bin/bash 【e15是容器ID】
安裝中文包,onlyoffice中文字體包,解壓之后運行docker_run.sh
4:123.rar文件是編輯word的代碼,onlyoffceExample是接受文件的代碼
https://gitee.com/zhuhaos/onlyoffice/repository/archive/master.zip
5:H5頁面配置,【必須使用ip地址而不是localhost】
<!DOCTYPE html> <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="utf-8" /> <title></title> </head> <body > <div id="placeholder" ></div> <script type="text/javascript" src="http://192.168.1.140:8703/web-apps/apps/api/documents/api.js"></script> <script type="text/javascript"> var config = { "editorConfig": { "lang": "zh-CN", "mode": "edit", }, "document": { "fileType": "docx", "key": "Khirzs6zTPdfd27", "title": "Example Document Title.docx", "url": "http://192.168.1.140/1234.docx",//這里填寫文檔的url路徑 }, "documentType": "text", "lang": "zh-CN", }; var docEditor = new DocsAPI.DocEditor("placeholder", config); </script> </body> </html >
6:存在的問題必須使用【社區版本】,一個是【中文字體】
7:關閉頁面后,自動保存的回調.
body:{"key":"12NAFE","status":2,"url":"http://192.168.1.140:8702/cache/files/12NAFE_3573/output.docx/output.docx?md5=Ig6ycB-dGH708fuNDt-Tsg==&expires=1623199603&disposition=attachment&ooname=output.docx","changesurl":"http://192.168.1.140:8702/cache/files/12NAFE_3573/changes.zip/changes.zip?md5=asEzUMiPjS5a-17wxp7oPA==&expires=1623199603&disposition=attachment&ooname=output.zip","history":{"serverVersion":"5.1.3","changes":[{"created":"2021-06-09 00:16:31","user":{"id":"uid-1623197783691","name":"Anonymous"}},{"created":"2021-06-09 00:16:43","user":{"id":"uid-1623197795750","name":"Anonymous"}},{"created":"2021-06-09 00:24:48","user":{"id":"uid-1623198283436","name":"Anonymous"}}]},"users":["uid-1623198283436"],"actions":[{"type":0,"userid":"uid-1623198542944"}],"lastsave":"2021-06-09T00:27:54.050Z","notmodified":false}
8:文件接收關鍵代碼【一般處理程序】
public void ProcessRequest(HttpContext context) { string body; using (var reader = new StreamReader(context.Request.InputStream)) body = reader.ReadToEnd(); var fileData = new JavaScriptSerializer().Deserialize<Dictionary<string, object>>(body); if (fileData != null && fileData["status"].ToString() == "2") { var req = WebRequest.Create((string)fileData["url"]); string PATH_FOR_SAVE = context.Server.MapPath("~/temp/") + DateTime.Now.ToString("yyyyMMddhhmmss") + ".docx"; using (var stream = req.GetResponse().GetResponseStream()) using (var fs = File.Open(PATH_FOR_SAVE, FileMode.Create)) { var buffer = new byte[4096]; int readed; while ((readed = stream.Read(buffer, 0, 4096)) != 0) fs.Write(buffer, 0, readed); } } context.Response.Write("{\"error\":0}"); }
感謝你能夠認真閱讀完這篇文章,希望小編分享的“docker如何安裝部署onlyoffice”這篇文章對大家有幫助,同時也希望大家多多支持億速云,關注億速云行業資訊頻道,更多相關知識等著你來學習!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。