Docker和Nginx中的Apache NiFi

问题描述 投票:0回答:1

我正在尝试在EC2实例上的Docker容器中部署Apache NiFi。目前仅打开2个端口(80和443),我无权对其进行更改。

我设法启动了NiFi:

sudo docker run --name nifi   -p 8080:8080   -d   apache/nifi:latest

这是我的Nginx配置:

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
    worker_connections 1024;
}
http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    access_log  /var/log/nginx/access.log  main;
    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;
    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    include /etc/nginx/conf.d/*.conf;
    upstream nifi {
        server 0.0.0.0:8080;
        }
    server {
        listen       80 default_server;
        listen       [::]:80 default_server;
        server_name  _;
        root         /usr/share/nginx/html;

        location / {
                proxy_pass http://nifi;
                proxy_set_header Origin http://nifi;
        }
        error_page 404 /404.html;
            location = /40x.html {
        }
        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }
}

目前,NiFi工作正常,我可以通过实例的IP访问它。 proxy_set_header Origin http://nifi;设置解决了将模板上传到服务的问题。

问题是我根本无法配置任何处理器。每次,当我单击“配置”时,都会出现此错误:

Unable to communicate with NiFi
Please ensure the application is running and check the logs for any errors.

enter image description here

您能帮我解决这个问题吗?

我在日志中看不到任何有用的东西。一旦出现关于不使用HTTPS的错误,但我认为这无关。

docker nginx amazon-ec2 apache-nifi minify
1个回答
0
投票

经过几天摆弄Docker,Nginx和NiFi之后,我发现了问题。当我在浏览器中打开网络日志时,我注意到Nifi正在向0.0.0.0或nifi(上游的名称)发送请求。

enter image description here

我必须在我的Nginx配置文件中设置proxy_set_header X-ProxyHost,它像一个超级按钮一样工作。我使用服务器的公共IP,也许以后再切换到域名。

此问题的主要问题是缺少日志:我检查了nifi和nginx的所有日志,没有什么有趣的。我仍然想知道这是否是错误。

© www.soinside.com 2019 - 2024. All rights reserved.