Zeit Now 部署的 NGINX 代理

NGINX proxy to a Zeit Now deployment

我有几个应用程序服务器 运行 几个节点应用程序(通过 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 吗?

现在服务器要求使用 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;
}