Skip to content
This repository was archived by the owner on Nov 2, 2024. It is now read-only.

Commit 14d7da7

Browse files
authored
docs(themes/kami): add a proxy section for kami (#11)
1 parent 61e553e commit 14d7da7

File tree

1 file changed

+117
-1
lines changed

1 file changed

+117
-1
lines changed

pages/themes/kami.mdx

Lines changed: 117 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,120 @@ pnpm build
6767
```bash
6868
pnpm prod:pm2
6969
```
70-
</Steps>
70+
71+
### 反向代理
72+
73+
```nginx
74+
server {
75+
## 反向代理开始
76+
## WebSocket 地址
77+
location /socket.io {
78+
proxy_set_header Upgrade $http_upgrade;
79+
proxy_set_header Connection "Upgrade";
80+
proxy_buffering off;
81+
proxy_set_header Host $host;
82+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
83+
proxy_set_header X-Forwarded-Proto $scheme;
84+
proxy_pass http://127.0.0.1:2333/socket.io;
85+
}
86+
## API 地址
87+
location /api/v2 {
88+
proxy_pass http://127.0.0.1:2333/api/v2;
89+
}
90+
## 简读 render 地址
91+
location /render {
92+
proxy_pass http://127.0.0.1:2333/render;
93+
}
94+
## Kami 地址
95+
location / {
96+
proxy_pass http://127.0.0.1:2323;
97+
}
98+
## 后台地址
99+
location /qaqdmin {
100+
proxy_pass http://127.0.0.1:2333/qaqdmin;
101+
}
102+
## 本地后台地址
103+
location /proxy {
104+
proxy_pass http://127.0.0.1:2333/proxy;
105+
}
106+
## RSS 地址
107+
location ~* \/(feed|sitemap|atom.xml) {
108+
proxy_pass http://127.0.0.1:2333/$1;
109+
}
110+
## 反向代理结束
111+
}
112+
```
113+
114+
完整示例如下
115+
116+
```nginx
117+
server {
118+
listen 80;
119+
listen 443 ssl http2 ;
120+
## 绑定域名
121+
server_name www.example.com;
122+
index index.html;
123+
proxy_set_header Host $host;
124+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
125+
proxy_set_header X-Forwarded-Host $server_name;
126+
proxy_set_header Upgrade $http_upgrade;
127+
proxy_set_header Connection "upgrade";
128+
error_log /www/sites/www.example.com/log/error.log;
129+
access_log /www/sites/www.example.com/log/access.log;
130+
location /socket.io {
131+
proxy_set_header Upgrade $http_upgrade;
132+
proxy_set_header Connection "Upgrade";
133+
proxy_set_header Host $host;
134+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
135+
proxy_set_header X-Forwarded-Proto $scheme;
136+
proxy_pass http://127.0.0.1:2333/socket.io;
137+
}
138+
location /api/v2 {
139+
proxy_pass http://127.0.0.1:2333/api/v2;
140+
}
141+
location /render {
142+
proxy_pass http://127.0.0.1:2333/render;
143+
}
144+
location / {
145+
proxy_pass http://127.0.0.1:2323;
146+
}
147+
location /qaqdmin {
148+
proxy_pass http://127.0.0.1:2333/qaqdmin;
149+
}
150+
location /proxy {
151+
proxy_pass http://127.0.0.1:2333/proxy;
152+
}
153+
location ~* \/(feed|sitemap|atom.xml) {
154+
proxy_pass http://127.0.0.1:2333/$1;
155+
}
156+
ssl_certificate /www/sites/www.example.com/ssl/fullchain.pem;
157+
ssl_certificate_key /www/sites/www.example.com/ssl/privkey.pem;
158+
ssl_protocols TLSv1.3 TLSv1.2 TLSv1.1 TLSv1;
159+
ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!3DES:!MD5:!PSK';
160+
ssl_prefer_server_ciphers on;
161+
ssl_session_cache shared:SSL:10m;
162+
ssl_session_timeout 10m;
163+
error_page 497 https://$host$request_uri;
164+
limit_conn perserver 300;
165+
limit_conn perip 25;
166+
limit_rate 512k;
167+
}
168+
```
169+
### 完成
170+
171+
<Callout type="info">
172+
如果您按照文档示例配置 Nginx 反向代理,您要时刻记住,您的:
173+
- API 地址为 `https://www.example.com/api/v2`
174+
- Kami 地址为 `https://www.example.com`
175+
- GateWay 为 `https://www.example.com`
176+
- 后台为 `https://www.example.com/qaqdmin`
177+
- 本地后台为 `https://www.example.com/proxy/qaqdmin`
178+
</Callout>
179+
180+
</Steps>
181+
182+
<style global jsx>{`
183+
.nextra-content pre {
184+
max-height: 50vh;
185+
}
186+
`}</style>

0 commit comments

Comments
 (0)