【问题标题】:NGINX proxy to a Zeit Now deployment到 Zeit Now 部署的 NGINX 代理
【发布时间】:2018-06-21 22:00:39
【问题描述】:

我有几个应用服务器运行多个 Node 应用程序(通过 PM2)。

我有一台 NGINX 服务器,它具有域的 SSL 证书和节点应用程序的反向代理。

在 NGINX 配置文件中,我使用它们的位置块设置域,如下所示:

server {
        listen 443 ssl;
        server_name
          geolytix.xyz;

        ssl_certificate /etc/letsencrypt/live/geolytix.xyz/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/geolytix.xyz/privkey.pem;

        location /demo {
            proxy_pass http://159.65.61.61:3000/demo;
            proxy_set_header HOST $host;
            proxy_buffering off;
        }

        location /now {
            proxy_pass https://xyz-heigvbokgr.now.sh/now;
            proxy_set_header HOST $host;
            proxy_buffering off;
        }
}

这仅适用于应用程序服务器。 Zeit Now 部署的代理产生了一个错误的网关。如果我转到部署的 Zeit Now 地址,应用程序本身会按预期工作。

有人知道我是否会遗漏一些设置来代理 Zeit Now 吗?

【问题讨论】:

    标签: nginx reverse-proxy vercel


    【解决方案1】:

    现在服务器需要使用 SNI 进行 https 连接。像几乎所有现代网络服务器一样。 你需要添加

    proxy_ssl_server_name    on;
    

    到你的配置。

    最小的位置块如下:

    location / {
         proxy_set_header        host my-app.now.sh;
         proxy_ssl_server_name   on;
         proxy_pass              https://alias.zeit.co;
    }
    

    【讨论】:

      猜你喜欢
      • 2019-05-12
      • 1970-01-01
      • 1970-01-01
      • 2019-08-09
      • 1970-01-01
      • 2019-06-23
      • 2019-12-24
      • 2019-10-11
      • 2018-12-16
      相关资源
      最近更新 更多