【问题标题】:WildFly console served with nginxWildFly 控制台与 nginx 一起使用
【发布时间】:2017-04-22 09:54:32
【问题描述】:

我坚持在 AWS 上配置一个简单的反向代理。 由于我们有一台主机(反向代理 nginx)服务于公共访问,我决定遵循规则并创建以下配置。

server {
    listen      9990;
    server_name project-wildfly.domain.me;

    access_log  /var/log/nginx/wildfly.access.log;
    error_log   /var/log/nginx/wildfly.error.log;

    proxy_buffers 16 64k;
    proxy_buffer_size 128k;

    root   /var/www/;
    index  index.html index.htm;

    location /console {
        proxy_set_header Host $server_addr:$server_port;
        proxy_set_header X-Forwarded-Proto $scheme;

        add_header Cache-Control "no-cache, no-store";
        proxy_pass http://10.124.1.120:9990/console;
    }

    location /management {
        proxy_set_header Host $server_addr:$server_port;
        proxy_set_header X-Forwarded-Proto $scheme;

        add_header Cache-Control "no-cache, no-store";
        proxy_pass http://10.124.1.120:9990/management;
    }
}

这将为管理控制台提供服务,我可以使用该用户登录。然后出现这条消息:

访问被拒绝

访问此界面的权限不足。

错误日志中没有任何内容。感谢您的任何提示!

【问题讨论】:

    标签: nginx wildfly wildfly-10


    【解决方案1】:

    在将 Wildfly 15 和 nginx 1.10.3 配置为反向代理时,我遇到了同样的问题。 设置与第一篇非常相似,将 /management 和 /console 重定向到 wildflyhost:9990。

    我可以通过 :9990 直接访问控制台,在比较直接流量和 nginx 代理流量之间的网络流量时,我注意到 Origin 和 Host 不同。

    所以在我的情况下,解决方案是将 Nginx 中的 Origin 和 Host 标头强制为 Wildfly 所期望的。我在其他地方找不到这个解决方案,所以我在这里发布它以供将来参考,尽管线程很旧。

    location /.../ {
        proxy_set_header Host $host:9990;
        proxy_set_header Origin http://$host:9990;
    
        proxy_redirect off;
        proxy_http_version 1.1;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_pass_request_headers on;
        proxy_pass http://wildflyhost:9990
    ...
    }
    

    【讨论】:

      【解决方案2】:

      也许你需要开启management 模块。

      试试这个:sh standalone.sh -b 0.0.0.0 -bmanagement 0.0.0.0 &

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2015-05-22
        • 1970-01-01
        • 2019-12-06
        • 2019-05-11
        • 1970-01-01
        • 2018-05-11
        • 1970-01-01
        相关资源
        最近更新 更多