0

我已经使用https://datahubproject.io/docs/quickstart中的步骤启动了 datahub

然后用conf添加nginx

upstream datahub-front {
    server localhost:9002;
}

server {
    server_name  datahub.myhost.com;

    location / {
        proxy_pass http://datahub-front;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_redirect off;
    }

    listen 80; 
}

在http://datahub.myhost.com:9002一切正常

但在 http://datahub.myhost.com

我有

Request URL: https://datahub.myhost.com/
Request Method: GET
Status Code: 505 HTTP Version Not Supported

我认为在 nginx 中设置的一些 cfg 可以解决问题。请帮忙

4

1 回答 1

1

这是我用于特定位置的配置,它针对我的公共服务器上的特定端口:

location /somelocation/ {
      proxy_pass http://localhost:8080/;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection 'upgrade';
      proxy_set_header Host $host;
      proxy_cache_bypass $http_upgrade;
  }

在您的情况下,我认为 proxy_path 必须指示真实端口(在您的情况下为 9002),但$http_upgrade对于错误听起来也不错505;)

于 2021-10-08T18:42:28.357 回答