NebulaGraph Studio Nginx 部署

考虑到很多同学问到,这里给出一个 NebulaGraph Studio 3.6.0 以后的(引入了 websocket 之后)的 nginx 配置方式的例子。

注意,现在 https 情况下似乎会有问题在这里 track https://github.com/vesoft-inc/nebula-studio/issues/599

events {
}

http {
    server {
        listen 80;
        server_name nebula-demo.siwei.io;
        location / {
            proxy_pass http://web:7001;
        }

        location /nebula_ws {
            proxy_pass http://web:7001;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
        }
    }

    server {
        listen 443 ssl;
        server_name nebula-demo.siwei.io;
        ssl_certificate /cert/fullchain.pem;
        ssl_certificate_key /cert/privkey.pem;
        location / {
            proxy_pass http://web:7001;
        }

        location /nebula_ws {
            proxy_pass http://web:7001;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
        }
    }
}
3 个赞

我安装3.7.0版本,遇到 websocket url is empty的问题,按这个配置没有解决问题

请注意 上边的 issue https/wss 是会有问题,用http/ws 呢?

cc @hetao

用http/ws 也是一样的问题

嗯,是不是配置的问题?分享一下你的?

server {
    listen 80;
    server_name nebula-graph.fangcha.io;
    location / {
            proxy_pass  http://127.0.0.1:7001;
    }

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

}

/ws 路径不对,参考我的

改成/nebula_ws,还是不work
我的nebula-graph版本3.6.0, studio 版本3.7.0

server {
    listen 80;
    server_name nebula-graph.fangcha.io;
    location / {
            proxy_pass  http://127.0.0.1:7001;
    }

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

}

奇怪,我这边是没问题的

Nginx:

events {
}

http {
    server {
        listen 80;
        server_name nebula-demo.siwei.io;
        location / {
            proxy_pass http://web:7001;
        }

        location /nebula_ws {
            proxy_pass http://web:7001;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
        }
    }

    server {
        listen 443 ssl;
        server_name nebula-demo.siwei.io;
        ssl_certificate /cert/fullchain.pem;
        ssl_certificate_key /cert/privkey.pem;
        location / {
            proxy_pass http://web:7001;
        }

        location /nebula_ws {
            proxy_pass http://web:7001;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
        }
    }
}

Studio & Nginx in docker

version: '3.4'
services:
  web:
    image: vesoft/nebula-graph-studio:v3.7.0
    environment:
      USER: root
    ports:
      - 7001
    networks:
      - nebula-net
  nginx:
    image: nginx:1.17.6
    ports:
      - 7001:80
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf
      - ./cert:/cert
    networks:
      - nebula-net

networks:
  nebula-net:
    external: true