dhr2333 / Beancount-Trans

账单解析器,以Baen格式记录。Bill parser, recorded in Bean format.
https://trans.dhr2333.cn/
32 stars 1 forks source link

docker部署nginx反代返回空白页 #4

Closed xiaoyuesansui closed 8 months ago

xiaoyuesansui commented 9 months ago

您好

按照文档使用docker部署,使用nginx 反代localhost:38001返回空白页,如果浏览器直接localhost:38001可正常访问

nginx 配置如下

  location = /bill {
    proxy_pass http://192.168.50.49:38001;
    proxy_redirect off;
    proxy_set_header        X-Real-IP       $remote_addr;
    proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $host;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";

浏览器控制台先是someblock was loaded over HTTPS

如果我添加

   proxy_set_header X-Forwarded-Proto $scheme;
   add_header 'Content-Security-Policy' 'upgrade-insecure-requests';

则只显示time out error

请指导nginx正确的配置方法 谢谢

dhr2333 commented 9 months ago

一般是推荐docker compose的方式部署的,因为前端项目中已经配置好直接通过http://beancount-trans-backend:8000来访问后端。

如果你的Nginx是通过单个容器部署的话,确实是无法访问后端服务的,具体原因可以了解Docker的网络环境。

dhr2333 commented 8 months ago

Closed