avatar

十六小站

欢迎来到我的个人主页! 期待与您分享我的经验与故事,一起探索技术的无穷可能!

  • 首页
  • NAS专题
  • 关于
Home onlyoffice配置
文章

onlyoffice配置

Posted 2025-03-27 Updated 2025-03- 28
By 十六
5~7 min read
  1. onlyoffice层配置别名请求,解决多数场景下,系统只有一个请求入口的情况。

目前这里只附加nginx配置 ,后续补充部署配置:别名统一为:my_office

这里主要需要代理的有api.js的入口路径和cache的文件库路径。

cache路径需要修配office的default.json配置,修改如下:

storage:{
  "bucketName":"my_office/cache"
}

nginx配置如下:

        map $http_host $this_host {
          "" $host;
          default $http_host;
        }
        map $http_x_forwarded_proto $the_scheme {
          default $http_x_forwarded_proto;
          "" $scheme;
        }
        map $http_x_forwarded_host $the_host {
          default $http_x_forwarded_host;
          "" $this_host;
        }
        map $http_upgrade $proxy_connection {
          default upgrade;
          "" close;
        }
        proxy_set_header Host $http_host;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $proxy_connection;
        proxy_set_header X-Forwarded-Host $the_host;
        proxy_set_header X-Forwarded-Proto $the_scheme;
        server {
          listen 0.0.0.0:8093;
          listen [::]:8093 default_server;
          server_tokens off;
          rewrite ^\/OfficeWeb(\/apps\/.*)$ /web-apps$1 redirect;
          location /sino_office/ {
                proxy_pass http://localhost:8000/;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
                proxy_read_timeout 3600s;  # 设置较长的超时时间 
          }

          location /sino_office/cache/ {
                proxy_pass http://localhost:8000/sino_office/cache/;
                proxy_http_version 1.1;
          }

        }

外层代理配置,统一入口,后续可以在这里添加负载均衡:

server {
    listen 80;
    server_name _;
 
    location /sino_office {
        # 基本代理设置 
        proxy_pass http://192.168.1.135:8093/my_office/;
        
        # 请求头设置(包含端口信息)
        proxy_set_header Host $host:$server_port;
        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;
        proxy_set_header X-Forwarded-Port $server_port;
 
        # WebSocket 支持 
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_read_timeout 3600s;  # 设置较长的超时时间 
    }
}

License:  CC BY 4.0
Share

Further Reading

OLDER

Jvm参数

NEWER

在WEB中子线程可以访问Request上下文

Recently Updated

  • Onlyoffice编译
  • K6+Playwright实现并发测试
  • 简单规则引擎
  • 在WEB中子线程可以访问Request上下文
  • onlyoffice配置

Trending Tags

Java Docker 前端 中间件 数据库 群晖 unraid

Contents

©2025 十六小站. 陕ICP备2023009742号-2