Skip to content

Commit be4adcc

Browse files
committed
Add nginx configure
1 parent b4fd353 commit be4adcc

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed

docs/zh/integration/nginx.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
---
2+
title: "RustFS Nginx反向代理配置"
3+
description: "为 RustFS实现Nginx反向代理的配置"
4+
---
5+
6+
# 一、RustFS Nginx 前置条件
7+
8+
为了让集成顺利进行,你需要提前准备了:
9+
10+
1. RustFS Server 安装正常,并且正确启动;
11+
2. 确定RustFS的端口;
12+
3. Nginx标识正确;
13+
4. 确认RustFS 单机或者集群的IP地址。
14+
15+
16+
17+
# 二、 配置文件
18+
19+
20+
~~~
21+
22+
23+
upstream rustfs {
24+
least_conn;
25+
server 127.0.0.1:9000;
26+
}
27+
server {
28+
listen 8000;
29+
listen [::]:8000;
30+
server_name _;
31+
32+
# Allow special characters in headers
33+
ignore_invalid_headers off;
34+
# Allow any size file to be uploaded.
35+
# Set to a value such as 1000m; to restrict file size to a specific value
36+
client_max_body_size 0;
37+
# Disable buffering
38+
proxy_buffering off;
39+
proxy_request_buffering off;
40+
41+
location / {
42+
proxy_set_header Host $http_host;
43+
proxy_set_header X-Real-IP $remote_addr;
44+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
45+
proxy_set_header X-Forwarded-Proto $scheme;
46+
47+
proxy_connect_timeout 300;
48+
# Default is HTTP/1, keepalive is only enabled in HTTP/1.1
49+
proxy_http_version 1.1;
50+
proxy_set_header Connection "";
51+
chunked_transfer_encoding off;
52+
53+
proxy_set_header Upgrade $http_upgrade;
54+
proxy_set_header Connection "upgrade";
55+
56+
57+
58+
59+
proxy_pass http://rustfs; # This uses the upstream directive definition to load balance
60+
}
61+
}
62+
63+
~~~
64+
65+
66+
# 三、多机负载均衡
67+
68+
69+
若需要在分布式环境中增加多个RustFS服务器,请提前调整好DNS解析或者本地的Hosts地址,修改和增加 server即可。
70+
71+
~~~
72+
upstream rustfs {
73+
least_conn;
74+
server 10.0.0.1:9000;
75+
server 10.0.0.2:9000;
76+
server 10.0.0.3:9000;
77+
server 10.0.0.4:9000;
78+
}
79+
~~~
80+
81+
82+

0 commit comments

Comments
 (0)