onlyoffice 源码编译,破解20连接数限制,并部署到centos7
前言
1.本教程用于从源码编译onlyoffice,顺便破解20可编辑的限制。
2.将生成包部署到另外一台设备上的部署过程。
一、环境准备
编译环境:ubuntu 1404(一定要用这个版本)
测试环境:centos7
代理:必须保证顺畅链接,否则编译非常困难
*建议将防火墙关闭进行测试。
二、编译
参考链接:https://helpcenter.onlyoffice.com/server/linux/document/compile-source-code.aspx
链接比较详细,依次执行即可,下面主要介绍代理使用的位置:
在执行 “./automate.py server”命令之前执行
git config --global http.proxy 172.16.10.240:xxx export https_proxy="http://172.16.10.240:xxx" ./automate.py server
此处等待N小时
验证程序:https://api.onlyoffice.com/editors/example/java
使用程序验证部署是否成功
三、破解
1:修改位置: build_tools目录/server/Common/sources/contants.js
exports.LICENSE_CONNECTIONS = 20;#将此处修改你想要的连接数
2. 再次编译:
首先修改 automate.py 文件
build_tools_params = ["--branch", branch, "--module", modules, "--update", "0", #此处修改为0,否则会覆盖你修改的文件 "--qt-dir", os.getcwd() + "/qt_build/Qt-5.9.9"]
执行编译
git config --global http.proxy 172.16.10.240:xxx export https_proxy="http://172.16.10.240:xxx" ./automate.py server
再次等待N小时(欢迎大神能赐教能够单独打包的方式)
尝试是否可以打开超过20个连接限制
四、将编译后的文件部署到centos
环境准备
#安装nginx
yum install nginx
#修改配置文件 /etc/nginx/nginx.conf
http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; 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 80; server_name localhost; rewrite ^\/OfficeWeb(\/apps\/.*)$ /web-apps$1 redirect; location / { proxy_pass http://localhost:8000; proxy_http_version 1.1; } location /spellchecker/ { proxy_pass http://localhost:8080/; proxy_http_version 1.1; } } }
#重启
nginx -s stop nginx
#安装rabbitmq
rpm -Uvh https://mirrors.tuna.tsinghua.edu.cn/epel/7/x86_64/Packages/e/epel-release-7-12.noarch.rpm yum install erlang
# 下载rabbitmq
wget https://www.rabbitmq.com/releases/rabbitmq-server/v3.6.15/rabbitmq-server-3.6.15-1.el7.noarch.rpm
# 安装rabbitmq
yum install rabbitmq-server-3.6.15-1.el7.noarch.rpm
# 启动rabbitmq服务
service rabbitmq-server start
#安装postgresql,参考编译环境的部署方式
将生成的文件复制到centos上
编译环境目录:build_tools/out
centos目录:/root/onlyoffice/out(可以是任意目录)
设置执行权限
chmod -R 777 /root/onlyoffice/out/linux_64/onlyoffice/documentserver/server/FileConverter chmod -R 777 /root/onlyoffice/out/linux_64/onlyoffice/documentserver/server/DocService chmod -R 777 /root/onlyoffice/out/linux_64/onlyoffice/documentserver/server/SpellChecker/spellchecker
启动
参照编译环境启动(可以不用生成 fonts 和 themes)