Skip to content

Commit

Permalink
Update deploy.md
Browse files Browse the repository at this point in the history
  • Loading branch information
dairoot authored Oct 16, 2024
1 parent bc7de08 commit f7af17e
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions docs/deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ cp .env.example .env && vi .env # 修改管理后台账号密码
```

#### 2.1 配置 nginx (需要配置 https)
⚠️ 记得将 `chatgpt.example.com` 替换为自己域名,总有人忘记

```conf
proxy_cache_path /etc/nginx/cache/chatgpt levels=1:2 keys_zone=chatgpt_cache:20m inactive=1d max_size=5g;
Expand Down Expand Up @@ -79,6 +80,8 @@ server {
#### 2.2 如果使用 `cloudflare` 小黄云代理,则无需 https。nginx 配置如下

```bash
proxy_cache_path /etc/nginx/cache/chatgpt levels=1:2 keys_zone=chatgpt_cache:20m inactive=1d max_size=5g;

upstream chatgpt {
server 127.0.0.1:50001;
# server 127.0.0.1:50002;
Expand All @@ -88,10 +91,30 @@ server {
listen 80;
server_name chatgpt.example.com;

# 日志文件
#access_log /data/logs/ngx.chatgpt.access.log json_combined;
# GLOBAL-CACHE START
location ~* \.(js|css)$ {
proxy_cache chatgpt_cache;
proxy_cache_valid 200 60m; # 对状态码200的响应缓存60分钟

# 设置静态文件的缓存控制,浏览器缓存控制
expires 7d;

# 添加响应头部
add_header X-Cache-Status $upstream_cache_status;

proxy_redirect off;
proxy_set_header Host $host;
proxy_pass http://chatgpt;
}
# GLOBAL-CACHE END


# 日志文件 START
# access_log /data/logs/ngx.chatgpt.access.log json_combined;
access_log /data/logs/ngx.chatgpt.access.log;
error_log /data/logs/ngx.chatgpt.error.log;
# 日志文件 END


location / {
proxy_redirect off;
Expand Down

0 comments on commit f7af17e

Please sign in to comment.