Skip to content

Commit db5a1ce

Browse files
author
zhangpengyun
committed
Add nginx
1 parent 8dcbfcd commit db5a1ce

File tree

3 files changed

+32
-18
lines changed

3 files changed

+32
-18
lines changed

Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ COPY --from=frontend-builder /build/dist /usr/share/nginx/html
5050
# 复制 Nginx 配置文件
5151
COPY nginx.conf /etc/nginx/http.d/default.conf
5252

53+
# 暴露端口
54+
EXPOSE 80
55+
56+
# 启动Nginx和后端服务
57+
CMD ["sh", "-c", "nginx && ./wechat-reader"]
58+
COPY nginx.conf /etc/nginx/http.d/default.conf
59+
5360
# 设置时区
5461
ENV TZ=Asia/Shanghai
5562

nginx.conf

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,31 @@ server {
1111

1212
# 后端 API 代理
1313
location /api {
14-
proxy_pass http://localhost:8080;
14+
proxy_pass http://127.0.0.1:8080;
1515
proxy_set_header Host $host;
1616
proxy_set_header X-Real-IP $remote_addr;
17+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
1718
}
1819

1920
# 微信相关资源代理
2021
location /wx-images {
21-
proxy_pass http://localhost:8080;
22+
proxy_pass http://127.0.0.1:8080;
2223
proxy_set_header Host $host;
24+
proxy_set_header X-Real-IP $remote_addr;
25+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
2326
}
2427

2528
location /wx-qim {
26-
proxy_pass http://localhost:8080;
29+
proxy_pass http://127.0.0.1:8080;
2730
proxy_set_header Host $host;
31+
proxy_set_header X-Real-IP $remote_addr;
32+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
2833
}
2934

3035
location /wx-mp {
31-
proxy_pass http://localhost:8080;
36+
proxy_pass http://127.0.0.1:8080;
3237
proxy_set_header Host $host;
38+
proxy_set_header X-Real-IP $remote_addr;
39+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
3340
}
3441
}

node_modules/.vite/deps/_metadata.json

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)