AI 问答
你是一个数学家,请问9.9和9.11哪个大?
企业微信机器人发送消息脚本
AI 问数实现主要步骤
人类感知延迟
Chrome 存储介绍
浏览器缓存
Linux 命令行中 && 和 ; 区别和用法
Windows 系统怎么修改 CPU 的显示型号信息和查看真实的 CPU 型号信息
at 命令详细指南
如何确保提交代码到 git 上时 CRLF 转成 LF
Apache License 2.0
从 0 创建一个 docker 镜像
Linux 文件系统及分区表和 LVM
Linux 查看分区表类型
Windows 批量文件名重命名
将文本文件中的 CRLF 批量转换为 LF
批量将 GB2312 编码转换为 UTF-8 编码
分区类型 MBR 和 GPT 有什么区别
exFAT 和 FAT32 有什么区别
文件的元数据 是什么
花括号展开(Brace Expansion)
cat 显示特殊字符
图标文件有什么在线制作的站点
发布 Chrome 扩展程序的步骤
常用加密方式
密码学的常用攻击方式
3D 打印学习路径
新手 FDM 3D 打印学习路径
Linux 备份和还原 PostgreSQL 数据库方案
数学符号
通过 nginx 转发解决跨域问题
所有希腊字母及其读法
通过 Docker Compose 部署 lscr.io/linuxserver/libreoffice 服务
通过 Docker Compose 部署 libreoffice/online
在 Linux 上为 Docker 配置代理
数学公式测试
祖宗十八代
Windows 重启文件管理器
小米手机怎么设置特殊号码
国债逆回购终极操作指南(2025完整版)——从基础原理到高阶自动交易策略
本文档使用 MrDoc 发布
-
+
首页
通过 Docker Compose 部署 lscr.io/linuxserver/libreoffice 服务
通过 Docker Compose 部署 `lscr.io/linuxserver/libreoffice` 服务,并使用 Nginx 提供反向代理和基本认证,支持多个用户账号。 ## 目录和文件结构 确保项目目录结构如下: ```bash lsio/ ├── docker-compose.yml └── nginx/ ├── conf.d/ │ └── default.conf └── .htpasswd ``` ## 1. 创建 Docker Compose 配置文件 在项目根目录下创建 `docker-compose.yml` 文件: ```yaml services: libreoffice: image: lscr.io/linuxserver/libreoffice:latest container_name: libreoffice security_opt: - seccomp:unconfined #optional environment: - PUID=1000 - PGID=1000 - TZ=Asia/Shanghai volumes: - ./libreoffice/config:/config - ./libreoffice/docs:/docs # ports: # - 33000:3000 # - 33001:3001 # networks: # - mynet # 可以指定固定 ip networks: default: ipv4_address: 172.28.0.2 restart: unless-stopped nginx: image: nginx:latest container_name: nginx volumes: - ./nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf - ./nginx/.htpasswd:/etc/nginx/.htpasswd ports: - 4679:80 depends_on: - libreoffice # networks: # - mynet networks: default: ipv4_address: 172.28.0.3 #networks: # mynet: # 如果内网也有二类网,建议指定网段 networks: default: name: docker-lsio-net driver: bridge ipam: config: - subnet: 172.28.0.0/16 gateway: 172.28.0.1 ``` ## 2. 创建 Nginx 配置文件 在 `nginx/conf.d/` 目录下创建 `default.conf` 文件: ```bash server { listen 80; server_name localhost; location / { proxy_pass http://libreoffice:3000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; # 必须,处理 WebSocket 协议和压缩请求内容 proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Accept-Encoding gzip; auth_basic "Restricted Content"; auth_basic_user_file /etc/nginx/.htpasswd; } } ``` ## 3. 创建 .htpasswd 文件 使用 `htpasswd` 工具生成 `.htpasswd` 文件,并加入多个用户账号: ```bash # 在项目目录下执行(创建并添加第一个用户) htpasswd -c ./nginx/.htpasswd user1 # 添加其他用户 htpasswd -b ./nginx/.htpasswd user2 password2 htpasswd -b ./nginx/.htpasswd user3 password3 ``` 你可以根据需要添加更多用户。 ## 4. 启动 Docker Compose 服务 在项目根目录下执行以下命令启动服务: ```bash docker-compose up -d --build ``` ## 5. 访问 LibreOffice 服务 通过浏览器访问 `http://localhost:4679`。系统将提示输入用户名和密码,并使用 `.htpasswd` 文件中的用户名和密码进行验证。 ## 6. 切换用户的方式 用户可以通过以下几种方式切换账号: ### A. 清除浏览器缓存 1. 打开浏览器设置(例如 Chrome 的三个点菜单按钮) 2. 选择“更多工具” -> “清除浏览数据” 3. 选择要清除的内容(例如 Cookie 和其他网站数据) 4. 点击“清除数据” ### B. 使用私人/无痕窗口 用户可以在私人/无痕浏览模式中打开新会话: - 在 Chrome 中,点击右上角菜单按钮,选择“新建无痕模式窗口” - 在 Firefox 中,点击右上角菜单按钮,选择“新建隐私窗口” ### C. 直接在 URL 中输入账号 在地址栏输入 `http://username:password@localhost:4679`,例如: ```url http://user2:password2@localhost:4679 ``` 这种方法可能会有安全限制,因此不建议使用。 通过以上步骤,你可以成功部署和运行 Nginx 保护的多用户 LibreOffice 服务。如果有任何问题或需要进一步帮助,请随时告知!
七宇轩远
2024年06月25日
转发文档
收藏文档
上一篇
下一篇
手机扫码
复制链接
手机扫一扫转发分享
复制链接
Markdown文件
分享
链接
类型
密码
更新密码