通过nginx作为代理连接到AWS Neptune服务器

通过nginx作为代理连接到AWS Neptune服务器,nginx,amazon-neptune,Nginx,Amazon Neptune,AWS Neptune是专有网络专有的。我们无法从专有网络外部访问它。所以我在同一个VPC中创建了一个实例,并在其中安装了nginx。我这样配置nginx(跳过了side-config部分) 如果有人面临这样的问题,请帮助我 你能试试看这个吗?我给它做了一个快速测试,它似乎工作正常 http { upstream neptune { server <neptune_endpoint_without_protocol>:8182;

AWS Neptune是专有网络专有的。我们无法从专有网络外部访问它。所以我在同一个VPC中创建了一个实例,并在其中安装了nginx。我这样配置nginx(跳过了side-config部分)


如果有人面临这样的问题,请帮助我

你能试试看这个吗?我给它做了一个快速测试,它似乎工作正常

http {
        upstream neptune {
                server <neptune_endpoint_without_protocol>:8182;
                keepalive 15;
        }

        sendfile            on;
        tcp_nodelay         on;
        keepalive_timeout   65;
        types_hash_max_size 2048;
        server {
                listen 8182;
                error_log  /var/log/nginx/neptune.error.log;
                access_log  /var/log/nginx/neptune.access.log;
                location / {
                        proxy_pass http://neptune;
                        proxy_redirect off;
                        proxy_buffering off;

                        proxy_http_version 1.1;
                        proxy_set_header Connection "Keep-Alive";
                        proxy_set_header Proxy-Connection "Keep-Alive";
                }
        }
}
http{
海王星上游{
服务器:8182;
保持15;
}
发送文件到;
tcp_节点延迟开启;
保持生命超时65;
类型\散列\最大\大小2048;
服务器{
听8182;
error\u log/var/log/nginx/neptune.error.log;
access_log/var/log/nginx/neptune.access.log;
地点/{
代理通行证http://neptune;
代理_重定向关闭;
代理缓冲关闭;
proxy_http_版本1.1;
代理集头连接“保持活动”;
代理设置头代理连接“保持活动”;
}
}
}

虽然AWS Neptune有http端点,但我尝试使用nginx,但它不起作用。所以我尝试了nginx提供的不同指令。而stream指令就是我想要的。如果将来有人需要相同的解决方案,请发布答案

stream {
  server {
    listen 8182;
    proxy_pass <neptune_endpoint>:8182;
  }
}
流{
服务器{
听8182;
代理通行证:8182;
}
}

Hi@SV Madhava Reddy-我以前没有使用过Nginx,但我使用过ALB、NLB和SSH隧道。每当我遇到这种问题时,我尝试的第一件事就是看看我是否可以
curl:8182/status
如果您使用SSH连接到运行Nginx的EC2实例,那么curl从那里起作用吗?如果没有,您可能需要检查端口8182的安全组设置。感谢您的帮助。但是Aws Neptune拥有http端点。但如果您使用nginx进行路由,那么您必须使用stream指令。我现在就发布我的答案。谢谢
http {
        upstream neptune {
                server <neptune_endpoint_without_protocol>:8182;
                keepalive 15;
        }

        sendfile            on;
        tcp_nodelay         on;
        keepalive_timeout   65;
        types_hash_max_size 2048;
        server {
                listen 8182;
                error_log  /var/log/nginx/neptune.error.log;
                access_log  /var/log/nginx/neptune.access.log;
                location / {
                        proxy_pass http://neptune;
                        proxy_redirect off;
                        proxy_buffering off;

                        proxy_http_version 1.1;
                        proxy_set_header Connection "Keep-Alive";
                        proxy_set_header Proxy-Connection "Keep-Alive";
                }
        }
}
stream {
  server {
    listen 8182;
    proxy_pass <neptune_endpoint>:8182;
  }
}