docker安装部署onlyoffice的详细过程0. 系统要求
中央处理器 I5-10400F以上
内存 16 GB,最佳32G内存
硬盘⾄少40 GB的可⽤空间
1:安装Docker Desktop
2:进⼊BIOS设置CPU的虚拟化
3:启动Docker desktop
3:cmd进⼊,使⽤命令安装onlyoffice
安装通⽤版:
docker 163/gongzh/onlyoffice:latest
运⾏
docker run -i -t -d -p 8702:163/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是接受⽂件的代码5:H5页⾯配置,【必须使⽤ip地址⽽不是localhost】
<!DOCTYPE html>
<html lang="en" xmlns="/1999/xhtml">
<head>
<meta charset="utf-8" />
docker进入容器<title></title>
</head>
<body  >
<div id="placeholder" ></div>
<script type="text/javascript" src="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": "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":"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":"192.168.1.140:8 {"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的详细内容,更多关于docker部署 onlyoffice的资料请关注其它相关⽂章!

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。