Skip to content

Commit

Permalink
docs: 完善Docker部署前端Nginx配置
Browse files Browse the repository at this point in the history
  • Loading branch information
wangzmgit committed Oct 27, 2024
1 parent ef73443 commit de9af79
Showing 1 changed file with 58 additions and 1 deletion.
59 changes: 58 additions & 1 deletion docs/src/guide/deploy/domain.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@

### 配置Nginx

`/etc/nginx/conf.d/`目录新建`alnitak.conf`文件,内容如下:
`/etc/nginx/conf.d/`目录新建`alnitak.conf`文件,请根据部署方式选择对应的配置文件:

#### 手动部署前端

```
server {
listen 80; #默认80端口
Expand Down Expand Up @@ -61,6 +64,60 @@ server {
}
```

#### Docker部署前端

```
server {
listen 80; #默认80端口
server_name localhost; #这里可以改成自己的域名
client_max_body_size 1024M;
# 转发用户端
location / {
proxy_pass http://127.0.0.1:9010;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
# 后台管理
location /admin/ {
proxy_pass http://127.0.0.1:9030;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
# 移动端
location /mobile/ {
proxy_pass http://127.0.0.1:9020;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
# 转发后端
location /api/ {
proxy_pass http://127.0.0.1:9000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
```

### 重启Nginx
使用以下命令重启nginx

Expand Down

0 comments on commit de9af79

Please sign in to comment.