Amazon web services NGINX上指定的位置路径不工作
我有一个AWS EMR,我一直在尝试配置一个路径(/hbase),以便通过NGINX访问EMR中的hbase。为了实现我的目标,我创建了一个配置文件Amazon web services NGINX上指定的位置路径不工作,amazon-web-services,nginx,amazon-emr,Amazon Web Services,Nginx,Amazon Emr,我有一个AWS EMR,我一直在尝试配置一个路径(/hbase),以便通过NGINX访问EMR中的hbase。为了实现我的目标,我创建了一个配置文件/etc/nginx/conf.d/hbase.conf server { charset utf-8; listen 80; #Hbase works when location /hbase/ is replaced with location /. It does not work like below. location /h
/etc/nginx/conf.d/hbase.conf
server {
charset utf-8;
listen 80;
#Hbase works when location /hbase/ is replaced with location /.
It does not work like below.
location /hbase/
{
proxy_pass http://localhost:16010;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
这是我在EMR上的/etc/nginx/nginx.conf
#user nobody;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
include /etc/nginx/conf.d/*.conf;
log_format main '$remote_addr - [$time_local] "$request" '
'$status "$http_referer" '
'"$http_x_forwarded_for"';
sendfile on;
keepalive_timeout 65;
# HTTPS server
server {
listen 18888 ssl;
ssl_certificate /etc/ssl/certs/nginx.crt;
ssl_certificate_key /etc/ssl/certs/nginx.key;
server_name localhost;
location /webhdfs/v1/user {
proxy_pass http://localhost:14000;
proxy_read_timeout 1800;
proxy_connect_timeout 1800;
}
location /sessions {
proxy_pass http://localhost:8998;
proxy_read_timeout 1800;
proxy_connect_timeout 1800;
}
location /batches {
proxy_pass http://localhost:8998;
proxy_read_timeout 1800;
proxy_connect_timeout 1800;
}
location /proxy {
proxy_pass http://ip-10-100-0-4.ec2.internal:20888;
proxy_read_timeout 1800;
proxy_connect_timeout 1800;
}
} #end server tag
} #end http tag
问题是当我点击http://tempmyserverurl/hbase
它给我提供了404未找到错误。但是,当我在我的hbase.conf
中将位置/hbase更新为/时,它会重定向到master\u状态
,并且可以访问hbase UI
我只想让NGINX加载带有location/HBase
的HBase。我尝试过使用另一台服务器,并提到将代理传递到此EMR服务器,但它不起作用
有人能帮我找到正确的方向吗?帮我找出我在这里遗漏了什么
提前感谢。已给出
location /hbase
{
proxy_pass http://localhost:16010;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
请求http://example.com/hbase/some/path
将被代理到http://localhost:16010
likehttp://localhost:16010/hbase/some/path
这很可能不存在,因为hbase
在URL中,因此出现404错误
从
如果URI与地址一起指定,它将替换与位置参数匹配的请求URI部分
以这个例子来说,,请求http://example.com/hbase/some/path
将被代理到http://localhost:16010
likehttp://localhost:16010/some/path
从而从URL中删除hbase
,这很可能解决了问题。检查此URL并尝试更改代理\u密码http://localhost:16010
到proxy\u passhttp://localhost:16010/hbase
@Lamanus。我尝试将代理通行证更改为代理通行证。它给出了相同的HTTP 404错误(访问/hbase时出现问题)。我点击浏览器,收到404。感谢您的回复。我尝试了'location/hbase/{proxy\u pass;proxy\u set\u header X-Forwarded-for$proxy\u add\u X\u Forwarded\u for;}“当我点击http://example.com/hbase
请求被重定向到http://example.com/master-status
当我将/hbase/
像http://example.com/hbase/master-status
通过在地址栏中键入,我可以得到所需的结果(HBase UI可用)。我想这意味着我需要将/HBase
放在代理通行证中,我已经尝试了@Lamanus建议,但没有成功。
location /hbase
{
proxy_pass http://localhost:16010/;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}