【问题标题】:403 when trying to access /mod_cluster-manager?尝试访问 /mod_cluster-manager 时出现 403?
【发布时间】:2014-09-22 09:01:31
【问题描述】:

我正在使用 Apache 2.4.6 运行 CentOS 7。我正在尝试使用 mod_cluster 1.2.6 创建一个 Wildfly/JBoss 集群。我已经在 Mac OSX 上成功完成了这项工作,我只是想在我们的服务器环境中启动并运行它。

我的集群和虚拟主机配置如下所示:

 LoadModule slotmem_module       modules/mod_slotmem.so
 LoadModule proxy_cluster_module modules/mod_proxy_cluster.so
 LoadModule advertise_module     modules/mod_advertise.so
 LoadModule manager_module       modules/mod_manager.so

 MemManagerFile /var/cache/httpd

<VirtualHost *:80>

  <Directory />
    Order deny,allow
    Allow from all
  </Directory>

  KeepAliveTimeout 60
  MaxKeepAliveRequests 0
  ManagerBalancerName myBalancer
  ServerAdvertise On
  AdvertiseFrequency 3
  EnableMCPMReceive

  <Location /mod_cluster-manager>
    SetHandler mod_cluster-manager
    Order deny,allow
    Allow from all
  </Location>
</VirtualHost>

服务器启动正常,但是当我尝试访问 http://localhost/mod_cluster-manager 时,我得到一个 403 说权限被拒绝。这是我的 error_log 文件中的确切消息:

[Wed Jul 30 11:53:21.547109 2014] [authz_core:error] [pid 6012] [client 127.0.0.1:36425] AH01630: client denied by server configuration: /mod_cluster-manager

在 OSX 上运行时我没有遇到任何此类问题,所以我不完全确定问题是什么或为什么我得到 403。据我了解,Allow from all 指令应该是足以在通过 localhost 连接时授予我访问权限。有没有其他人遇到过类似的事情?我错过了什么吗?

【问题讨论】:

    标签: apache jboss wildfly mod-cluster


    【解决方案1】:

    关于配置

    是的,但修复很简单:Apache HTTP Server 2.4.x 采用 mod_authz 系统,需要稍微不同的配置,例如: 仅允许来自您的内部网络 10.10 的来自 EnableMCPMReceive 活动 VirtualHost 中工作程序节点的 MCMP 消息。:

    <Directory />
        Require ip 10.10.
    </Directory>
    

    或者为了开发更方便:

    <Directory />
        Require all granted
    </Directory>
    

    无论如何,这是 Apache HTTP Server 2.4.x 的默认配置示例之一:

    # Load mod_cluster modules
    # Please, note:
    #  - mod_cluster cannot coexist with proxy_balancer_module; disable it
    #  - mod_cluster needs proxy_module and proxy_ajp_module loaded for AJP transport
    
    LoadModule proxy_cluster_module modules/mod_proxy_cluster.so
    LoadModule cluster_slotmem_module modules/mod_cluster_slotmem.so
    LoadModule manager_module modules/mod_manager.so
    LoadModule advertise_module modules/mod_advertise.so
    
    # Place for slotmem files
    MemManagerFile cache/mod_cluster
    
    <IfModule manager_module>
      ## We suggest to use a restricted VirtualHost
      ## for receiving MCPM (Mod Cluster Protocol Message) from worker nodes. 
      Listen 6666
      <VirtualHost *:6666>
        <Directory />
          Require ip 127.0.0.1
        </Directory>
        ## Apache HTTP Server advertises its presence
        ## on 224.0.1.105:23364 by default.
        ServerAdvertise on
        EnableMCPMReceive
    
        ## Management and monitoring console
        <Location /mod_cluster_manager>
          SetHandler mod_cluster-manager
          Require ip 127.0.0.1
       </Location>
      </VirtualHost>
    </IfModule>
    

    关于 mod_cluster 版本

    请注意,mod_cluster 1.2.6.Final 已过时,它包含一些已在较新版本中修复的性能和安全相关错误。

    一定要下载mod_cluster 1.3.1.Final binaries或使用mod_cluster 1.3.1.Final Apache HTTP Server enabled load balancer Docker image。您也可以自己编译模块; Dockerfile 的内容可能会指导您了解 Linux 环境。

    【讨论】:

      【解决方案2】:

      你有降级版本。请尝试如下使用:

      <Directory />
          Order deny,allow
          Deny from all
          Allow from all
          Require all granted
      </Directory>
      

      【讨论】:

        【解决方案3】:

        尝试访问管理 URL:http://myHttpd:6666/mod_cluster_manager

        时收到错误响应“您无权访问此服务器上的 mod_cluster_manager”

        Apache 2.4 mod_cluster 1.3 要求我配置基本身份验证。

        转到 $HTTPD_HOME/bin 并创建一个登录帐户,例如“管理员”如下:

        ./htpasswd -c /etc/httpd/modclusterpassword admin
        

        然后,在您的 /etc/httpd/conf/httpd.conf 或其子包含文件之一(如 /etc/httpd/conf.d/mod_cluster.conf)中,找到您现在应该拥有的部分:

        <Location /mod_cluster_manager>
          SetHandler mod_cluster-manager
          AuthType Basic
          AuthName "MCM"
          AuthUserFile /etc/httpd/modclusterpassword
          Require user admin
        
          Order deny,allow
          Deny from all
          Allow from all
        </Location>
        

        并重新启动 HTTPD 服务。

        现在转到http://myHttpd:6666/mod_cluster_manager,将提示登录。使用 'admin' 和上面交互式提供的密码 vi 'htpasswd'。

        【讨论】:

          猜你喜欢
          • 2016-04-19
          • 1970-01-01
          • 2022-08-20
          • 2017-04-25
          • 1970-01-01
          • 1970-01-01
          • 2022-11-01
          • 2014-07-18
          • 2014-02-19
          相关资源
          最近更新 更多