Linux
onlyoffice配置https访问
onlyoffice配置https访问
前两篇跟大家分享了onlyoffice的部署配置以及二开,这一篇跟大家分享如何配置https访问,主要是今天下午接到雇主的消息,说是那边需要配置https,他自己又没搞定,所以让我帮他解决,最后还是成功解决了问题,特意记录一下方便后面查看。
下面就是直接贴出配置内容,大家可以参考一下
server { listen 443 ssl; server_name onlyoffice.test.cn; ssl_certificate /home/onlyoffice/cert/onlyoffice.test.cn.crt; ssl_certificate_key /home/onlyoffice/cert/onlyoffice.test.cn.key; location / { proxy_pass http://localhost:8701; 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 代理路径 location ~ ^/8.2.0-[a-z0-9]+/doc/ { proxy_pass http://localhost:8701; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; 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; } } server { listen 80; server_name onlyoffice.test.cn; return 301 https://$host$request_uri; # 强制 HTTP 跳转到 HTTPS }
假设我们的域名是onlyoffice.test.cn,然后onlyoffice访问端口是8701,大家根据自己的情况进行配置。
然后我们直接重启nginx就可以进行https访问了。
0条评论