19.8.4. 配置 ISAPI Redirector 发送客户请求到 JBoss EAP 6

概述

本节配置了一组 JBoss EAP 6 服务器接受来自 ISAPI Redirector 的请求。它没有包括对负载平衡和高可以性失效切换的配置。如果您需要这些功能,请参考 第 19.8.5 节 “配置 ISAPI Redirector 在多个 JBoss EAP 6 服务器间平衡客户请求”

这个是在 IIS 服务器上完成的,我们假定 JBoss EAP 6 已按照 第 19.3.6 节 “配置 JBoss EAP 6 接受外部 Web 服务器的请求” 进行了配置。

过程 19.18. 编辑属性文件和设置重定向

  1. 创建一个目录来存储日志、属性文件和锁文件。

    本过程剩余的部分将假定您在使用 C:\connectors\ 目录。如果您使用了不同的目录,请相应地修改这些说明。
  2. 创建 isapi_redirect.properties 文件。

    创建名为 C:\connectors\isapi_redirect.properties 的文件。复制下列内容到文件里。
    # Configuration file for the ISAPI Redirector
    # Extension uri definition
    extension_uri=/jboss/isapi_redirect.dll
    
    # Full path to the log file for the ISAPI Redirector
    log_file=c:\connectors\isapi_redirect.log
    
    # Log level (debug, info, warn, error or trace)
    # Use debug only testing phase, for production switch to info
    log_level=debug
    
    # Full path to the workers.properties file
    worker_file=c:\connectors\workers.properties
    
    # Full path to the uriworkermap.properties file
    worker_mount_file=c:\connectors\uriworkermap.properties
    
    #Full path to the rewrite.properties file 
    rewrite_rule_file=c:\connectors\rewrite.properties
    
    如果您不想使用 rewrite.properties 文件,请用 # 注释最后一行。详情请参考 步骤 5
  3. 创建 uriworkermap.properties 文件

    uriworkermap.properties 文件包含了部署的应用程序 URL 和处理请求的工作节点间的映射。下面的例子展示了这个文件的语法。请将您的 uriworkermap.properties 文件放入 C:\connectors\
    # images and css files for path /status are provided by worker01
    /status=worker01
    /images/*=worker01
    /css/*=worker01
    
    # Path /web-console is provided by worker02
    # IIS (customized) error page is used for http errors with number greater or equal to 400
    # css files are provided by worker01
    /web-console/*=worker02;use_server_errors=400
    /web-console/css/*=worker01
    
    # Example of exclusion from mapping, logo.gif won't be displayed  
    # !/web-console/images/logo.gif=*
    
    # Requests to /app-01 or /app-01/something will be routed to worker01
    /app-01|/*=worker01
    
    # Requests to /app-02 or /app-02/something will be routed to worker02
    /app-02|/*=worker02
    
  4. 创建 workers.properties 文件。

    workers.properties 文件包含工作标签和服务器实例间的映射定义。下面的示例文件展示了这个文件的语法。请将这个文件放入 C:\connectors\ 目录。
    # An entry that lists all the workers defined
    worker.list=worker01, worker02
    
    # Entries that define the host and port associated with these workers
    
    # First JBoss EAP 6 server definition, port 8009 is standard port for AJP in EAP 
    worker.worker01.host=127.0.0.1
    worker.worker01.port=8009
    worker.worker01.type=ajp13
    
    # Second JBoss EAP 6 server definition
    worker.worker02.host=127.0.0.100
    worker.worker02.port=8009
    worker.worker02.type=ajp13
    
  5. 创建 rewrite.properties 文件。

    rewrite.properties 文件包含了专有应用程序的简单 URL 重写规则。如下例所示,重写路径使用名称-值对来指定的。请将这个文件放入 C:\connectors\ 目录。
    #Simple example
    # Images are accessible under abc path
    /app-01/abc/=/app-01/images/
    
  6. 重启 IIS 服务器。

    通过 net stopnet start 命令重启 IIS 服务器。
    C:\> net stop was /Y
    C:\> net start w3svc
    
结果

根据应用程序配置 IIS 服务器发送客户请求到专门的 JBoss EAP 6 服务器。