乐云主机笔记

  • 首页
  • 学习记录
  • 资源下载
  • 新手教程
  • 其他
  • 脚本源码
  • 自用主机
  • 主机优惠
  • 域名优惠
  • 网赚项目

  1. 首页
  2. 新手教程
  3. 正文

基于debian11+宝塔面板+nginx+docker搭建openlist+onlyoffice实现挂载网盘并在线预览文档

2025年 6月 25日 10点热度 0人点赞 0条评论
最近风靡全网的alist网盘系统出现变故,可能存在较大隐患,于是博主根据网络各类资料采用openlist系统进行了替代,同时根据过往经验搭建了onlyoffice,实现了office文档和pdf文档的在线预览。现将过程记录一下:
1、搭建宝塔面板、安装nginx和docker环境。过程不多赘述。
2、使用docker安装openlist系统。方法如下:
1)openlist的docker安装 
docker run -d --restart=unless-stopped -v /etc/openlist:/opt/openlist/data -p 25244:5244 -e PUID=0 -e PGID=0 -e UMASK=022 --name="openlist" openlistteam/openlist:latest
2)设置密码
docker exec -it openlist ./openlist admin set NEW_PASSWORD
3)挂载网盘(略)
4)上传用于测试的OFFICE、pdf文档。
3、使用docker安装onlyoffice
1)安装onlyoffice(禁止JWT验证)
docker run -d --name onlyoffice \
-p 8081:80 \
-e JWT_ENABLED=false \
-v /onlyoffice/logs:/var/log/onlyoffice \
-v /onlyoffice/data:/var/www/onlyoffice/Data \
onlyoffice/documentserver
4、在宝塔面板新建静态网站,openlist.test.com
1)在根目录新建viewer.html,代码如下:
<!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://x.x.x.x:8081/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": true,
"download": true,
"print": true,
"fillForms": true,
},
"title": fileName,
"url": url,
},
"editorConfig": {
"lang": "zh-CN",
"mode": "view",
},
"height": "1080px",
"type": "desktop",
});
</script>
</body>
</html>

注意,viewer.html权限为www 0755

5、设置openlist的预览方式:
在openlist后台管理界面--设置--预览,编辑“Iframe 预览”代码,在office文件和pdf文件下方增加“
"onlyoffice":"http://openlist.test.com/viewer.html?src=$e_url",

标签: 暂无
最后更新:2025年 6月 25日

wangzhe12588

这个人很懒,什么都没留下

点赞
< 上一篇

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复

归档

  • 2025 年 6 月
  • 2025 年 5 月
  • 2025 年 4 月
  • 2025 年 3 月
  • 2025 年 2 月
  • 2025 年 1 月
  • 2024 年 12 月
  • 2024 年 11 月
  • 2024 年 10 月
  • 2024 年 9 月
  • 2024 年 7 月
  • 2024 年 3 月
  • 2024 年 2 月
  • 2024 年 1 月
  • 2023 年 12 月
  • 2023 年 11 月
  • 2023 年 10 月
  • 2023 年 9 月
  • 2023 年 8 月
  • 2023 年 7 月
  • 2023 年 6 月
  • 2023 年 5 月
  • 2023 年 4 月
  • 2023 年 3 月
  • 2023 年 2 月
  • 2023 年 1 月
  • 2022 年 12 月
  • 2022 年 11 月
  • 2022 年 10 月
  • 2022 年 9 月
  • 2022 年 8 月
  • 2022 年 7 月
  • 2022 年 6 月
  • 2022 年 5 月
  • 2022 年 4 月
  • 2022 年 3 月
  • 2022 年 2 月
  • 2022 年 1 月
  • 2021 年 12 月
  • 2021 年 11 月
  • 2021 年 10 月
  • 2021 年 9 月
  • 2021 年 8 月
  • 2021 年 7 月
  • 2021 年 6 月
  • 2021 年 5 月
  • 2021 年 4 月
  • 2021 年 3 月
  • 2021 年 2 月
  • 2021 年 1 月
  • 2020 年 12 月
  • 2020 年 11 月
  • 2020 年 10 月
  • 2020 年 9 月
  • 2020 年 8 月
  • 2020 年 7 月
  • 2020 年 6 月
  • 2020 年 5 月
  • 2020 年 4 月
  • 2020 年 3 月
  • 2020 年 2 月
  • 2020 年 1 月
  • 2019 年 12 月
  • 2019 年 11 月
  • 2019 年 10 月
  • 2019 年 9 月
  • 2019 年 8 月
  • 2019 年 7 月
  • 2019 年 6 月
  • 2019 年 5 月
  • 2019 年 4 月
  • 2019 年 3 月
  • 2019 年 2 月
  • 2019 年 1 月
  • 2018 年 12 月
  • 2018 年 11 月
  • 2018 年 10 月
  • 2018 年 9 月
  • 2018 年 8 月
  • 2018 年 7 月
  • 2018 年 6 月
  • 2018 年 5 月
  • 2018 年 4 月
  • 2018 年 3 月
  • 2018 年 2 月
  • 2017 年 12 月
  • 2017 年 11 月
  • 2017 年 10 月
  • 2017 年 9 月
  • 2017 年 8 月
  • 2017 年 7 月

分类

  • 主机优惠
  • 其他
  • 域名优惠
  • 学习记录
  • 新手教程
  • 网赚项目
  • 脚本源码
  • 自用主机
  • 资源下载

COPYRIGHT © 2021 Letcloud.cn. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang

粤ICP备15031609号-3