tryzealot / zealot

开源自部署移动应用、 macOS、Linux 和 Windows 应用分发平台,提供 iOS、Android SDK、fastlane 等丰富组件库 | Self-hosted Beta App Distribution for Android, iOS, macOS, Linux and Windows apps
https://zealot.ews.im
MIT License
1.09k stars 134 forks source link

按照官方教程配置,生成的链接域名异常,求助! #670

Closed Cleam closed 2 years ago

Cleam commented 2 years ago

激活链接异常

创建用户之后,点击用户对应的激活,显示的激活链接不正常(不应该是http且不应该出现443端口): image

用户邮箱收到的激活链接是正常的(即上面链接去掉443端口)

产品二维码链接异常

问题和激活链接一样,扫二维码得到的链接依然是http且带有443端口号,导致无法正常访问:

二维码链接也是可以通过去掉443端口正常访问。

上面链接仅描述问题,故隐藏了真实域名。

nginx的反向代理配置,按照官网文档,配置详情如下:

server {
    listen 80;
    server_name zealot.xx.xx;
    # return 301 https://$host$request_uri;
    location / {
        if ($request_method = GET) {
            rewrite ^ https://$host$request_uri? permanent;
        }
        return 405;
    }
}

server {
  listen 443 ssl;
  server_name zealot.xx.xx;

  access_log  /data/logs/nginx/access_zealot_xx_xx.log;
  error_log  /data/logs/nginx/error_zealot_tt_xx_xx.log;

  # ssl证书配置我已经在nginx.conf里面配置过了,这里注释掉了
  # ssl                 on;
  # ssl_certificate     /etc/certs/zealot-cert.key;
  # ssl_certificate_key /etc/certs/zealot.key;
  # ssl_session_timeout 5m;
  # ssl_session_cache   shared:SSL:1m;

  root /data/zealot/public;

  location ~* ^(/assets|/favicon.ico) {
    access_log        off;
    expires           max;
  }

  location / {
    proxy_redirect     off;
    proxy_set_header   Host               $host:$server_port;
    proxy_set_header   X-Forwarded-Host   $host:$server_port;
    proxy_set_header   X-Forwarded-Port   $server_port;
    proxy_set_header   X-Forwarded-Server $host;
    proxy_set_header   X-Real-IP          $remote_addr;
    proxy_set_header   X-Forwarded-For    $proxy_add_x_forwarded_for;
    proxy_buffering    on;
    proxy_pass         http://127.0.0.1:9008; # 这里我改了docker映射端口
  }

  location /cable {
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_pass http://127.0.0.1:9008;
  }

  error_page 500 502 503 504 /500.html;
  location = /500.html {
    root /data/zealot/public;
  }
}

我的环境

welcome[bot] commented 2 years ago

感谢你提交的问题或反馈,我会在有时间的时候回复在此期间你可以看看之前被解决的反馈说不定有你需要的答案。 Thanks for opening this issue, a maintainer will get back to you shortly!

icyleaf commented 2 years ago

可能我提供的 nginx 配置真有问题,我再测试一下哈 :D

icyleaf commented 2 years ago

你试试下面的配置:

server {
  listen 80;
  server_name localhost;    # CHANGE IT ON YOUR DOMAIN
  location /.well-known/acme-challenge/ { allow all; }
  location / { return 301 https://$host$request_uri; }
}

server {
  listen 443 ssl http2;
  server_name localhost;    # CHANGE IT ON YOUR DOMAIN

  # Configure your ssl cert and key file
  ssl_certificate       /etc/certs/zealot-cert.pem;
  ssl_certificate_key   /etc/certs/zealot.pem;

  ssl_ciphers           HIGH:!MEDIUM:!LOW:!aNULL:!NULL:!SHA;
  ssl_session_timeout   5m;
  ssl_session_cache     shared:SSL:1m;
  ssl_prefer_server_ciphers  on;

  root /app/public;

  location ~* ^(/assets|/favicon.ico) {
    access_log        off;
    expires           max;
  }

  location / {
    try_files $uri @zealot;
  }

  location @zealot {
    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_set_header X-Forwarded-Proto $scheme;
    proxy_set_header Proxy "";
    proxy_pass_header Server;

    proxy_pass http://zealot;    # CHANGE IT ON YOUR HOST AND PORT
    proxy_buffering on;
    proxy_redirect off;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
  }

  location /cable {
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_pass http://zealot;    # CHANGE IT ON YOUR HOST AND PORT
  }

  error_page 500 502 503 504 /500.html;
  location = /500.html {
    root /app/public;
  }
}
Cleam commented 2 years ago

@icyleaf 感谢大佬,按新的nginx配置之后就正常了。

有一个小问题就是如果要用http2,需要增加模块:ngx_http_v2_module,不然报错:nginx: [emerg] the "http2" parameter requires ngx_http_v2_module,我目前的nginx版本:nginx version: nginx/1.17.3

我暂时没用http2,先去掉了,也能正常访问。

再次感谢~ 😃

icyleaf commented 2 years ago

有问题再反馈