毕升Officenginx配置

毕升Officenginx 配置

默认情况下毕升Office部署完成之后是通过http://ip:3000 进行访问,如果你使用的虚拟云主机,通过公网IP进行访问,会存在一些问题,这时候就需要你配置niginx对后端的服务进行反向代理。为了你部署使用的方便,毕升Office提供了一套使用nginx进行方向代理的脚本,你可以根据你的需要进行修改部署。如果部署中有其他问题,欢迎加入毕升Office用户交流群。

毕升Office交流群

配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream s3{
ip_hash;
server localhost:9000 fail_timeout=30s ;
}
server {
listen 80;
server_name YOUR HOST;

location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
client_max_body_size 500m;
proxy_redirect off;
proxy_set_header x-scheme $scheme;
proxy_pass http://localhost:3000;
}
location /apps{
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
client_max_body_size 500m;
proxy_redirect off;
proxy_set_header x-scheme $scheme;
location /apps/drive {
proxy_pass http://localhost:3000/apps/drive;
}
location /apps/editor {
proxy_pass http://localhost:5500/apps/editor;
}
location /apps/console {
proxy_pass http://localhost:3000/apps/console;
}
location /apps/api {
proxy_pass http://localhost:3000/apps/api;
}
location /apps/license {
proxy_pass http://localhost:6100/apps/license;
}
location /apps/blog {
alias /usr/local/nginx/html/blog/;
#index index.html;
}
}
location /static{
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
client_max_body_size 500m;
proxy_redirect off;
proxy_set_header x-scheme $scheme;
location /static/drive {
proxy_pass http://localhost:3000/static/drive;
}
location /static/console {
proxy_pass http://localhost:3000/static/console;
}
location /static/office {
proxy_pass http://localhost:5500/static/office;
}
location /static/editor {
proxy_pass http://localhost:5500/static/editor;
}
location /static/license {
proxy_pass http://localhost:6100/static/license;
}

}
location /ws{
proxy_buffering on;
proxy_buffer_size 4k;
proxy_buffers 8 1m;
proxy_busy_buffers_size 2m;
proxy_max_temp_file_size 1024m;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
location /ws/drive {
proxy_pass http://localhost:3000/ws/drive;
}
location /ws/admin {
proxy_pass http://localhost:3000/ws/drive;
}
location /ws/editor {
proxy_pass http://localhost:5500/ws/editor;
}

}
location /s3/{
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_redirect off;
proxy_set_header x-scheme $scheme;
proxy_pass http://IP:9000/;
}
}

注意:

你在使用前需要修改 server_name为你想要提供服务的IP或者域名。

你需要将最后一行的“IP”修改为毕升Office部署服务器的内网IP

如果你部署nginx和毕升Office在同一台服务器上,则上面的配置文件不需要做太多的更改,上面的配置文件经过毕升Office官网使用测试。如果你的nginx服务器和毕升Office不在同一台服务器,则需要将localhost修改为毕升Office部署所在的内网IP

修改毕升Office配置

在完成了nginx配置之后,你还需要修改毕升Office的配置。首先进入到毕升Office安装的目录:例如我们的安装文档中使用的是 /data目录;然后修改 workspace/config/config.yml

1
2
cd /data
vi workspace/config/config.yml

修改如下配置项:

  1. statichost: 修改为: /s3

  2. editorurl: 修改为: http://server_name:5500/apps/editor

    注意:server_name 为你在nginx中配置的 server_name 值,如果你是采用https,则请将上面的http换成https。

image-20190305173658972

image-20190305173857212

关于使用apache2 进行反向代理

毕升Office暂时没有提供apache2的配置文件。你需要更加ningx的配置进行自行配置。也欢迎帮助我们丰富我们的部署方式。谢谢大家。欢迎大家加入毕升Office用户交流群

毕升Office交流群

欢迎登陆毕升文档了解更多详细信息