背景
很多时候对外端口只开放了一个,但是又需要使用onlyoffice进行文档预览
当前实践版本
onlyoffice8.3.0 docker-compose部署onlyoffice8.3.0并支持ssl,且支持通过nginx代理,关闭JWT配置
配置说明
配置如下
bash
location /onlyOffice/ {
# 这是onlyoffice的地址
proxy_pass https://localhost:64431/;
# 前缀配置,必须配置,可以看onlyoffice内部nginx中的重定向配置
set $the_prefix "/onlyOffice";
# 这里必须配置为$http_host,让ip+端口都能传递到onlyoffice,否则重定向时会出问题
proxy_set_header Host $http_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;
# 由于onlyoffice中有websocket调用,下面的配置需要加上
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
onlyoffice内部nginx的前缀标识