In real-world projects, it's common to find Apache web server as a front door to your application server. The advantages of such an architecture are as follows:

Speed: Apache is generally faster at serving static content than
JBoss Web server.
Security: The application server, which contains sensitive data, can then be
placed in a protected area and, from a security point of view, you only need
to worry about the Apache server. Essentially, Apache becomes a smart
proxy server.
Load balancing and clustering. By using Apache as a frontend you
can handle traffic to multiple JBoss Web server instances. If one of your
JBoss AS fails, the communication transparently continues to another
node in the cluster.

Connecting Apache and JBoss AS can be done by means of several libraries: in the past, most projects have adopted either Tomcat's mod_jk library or Apache's mod_proxy libraries. Because the installation of either mod_jk or mod_proxy does not differ from earlier AS releases, we will just include a quick setup guide for your reference.

If, however, you are planning to set up a high-performance, dynamic cluster of web servers, we suggest you migrate to the newer mod_cluster API.

Since Apache 1.3, there's support for an optional module, named mod_proxy, that configures Apache to act as a proxy server. This can be used to forward requests for particular web applications such as Tomcat or JBoss, without having to configure a web connector such as mod_jk.

So, mod_proxy just requires including the following directives in your Apache's httpd.conf file:
LoadModule proxy_module modules/mod_proxy.so

Then, include two directives in your httpd.conf file for each web application that you wish to forward to JBoss AS. For example, to forward an application at context path /myapp:
ProxyPass /myapp http://localhost:8080/myapp
ProxyPassReverse /myapp http://localhost:8080/myapp

This tells Apache to forward URLs of the form http://localhost/myapp/* to the JBoss HTTP connector listening on port 8080.

Apache's mod_proxy is TCP-based and uses the HTTP, so you don't need to add anything else in your JBoss configuration. By definition, this is the simplest way to put Apache in front of JBoss, but also the slowest way to do it .

In Apache 2.2, there's support for another module, named mod_proxy ajp, which can be used in much the same way as mod_proxy. However, it uses AJP protocol to proxy Apache requests to JBoss AS. In order to use it, add the following directive to your Apache configuration:
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so

Then, enable proxy pass to JBoss AS with this directive:
ProxyPass / ajp://localhost:8009/
ProxyPassReverse / ajp://localhost:8009/

Here, we are simply redirecting all traffic ("/") to the web server listening on localhost at port 8009.

Since mod_proxy_ajp runs on a dedicated port, you have to activate it on your
JBoss side:

<subsystem xmlns="urn:jboss:domain:web:1.1">
<connector name="http" protocol="HTTP/1.1" socket-binding="http" scheme="http"/>
<connector name="AJP" protocol="AJP/1.3" socket-binding="ajp" />
<virtual-server name="localhost">
<alias name="example.com"/>
</virtual-server>
</subsystem>
. . . . . .
<socket-binding-group name="standard-sockets" default-interface="default">
<socket-binding name="http" port="8080"/>
<socket-binding name="ajp" port="8009"/>
. . . .
</socket-binding-group>

Using Apache Web Server with Jboss AS 7的更多相关文章

  1. 使用mod_cluster进行apache httpd server和jboss eap 6.1集群配置

    本文简单介绍,使用mod_cluster进行apache httpd server和jboss eap 6.1集群配置.本配置在windows上测试通过,linux下应该是一样的.可能要稍作调整.后面 ...

  2. Django部署到Apache Web Server

    Windows环境下,将Django部署到Apache Web Server 在Windows上部署Django(用mod_wsgi)会出现各种奇怪的问题,现简单记录下配置过程及遇到的错误及解决方法. ...

  3. 解决Apache Web Server的几个错误

    一.安装好Apache后服务里没有Apache服务 在命令行进入安装apache的bin目录下,输入命令 httpd.exe -k install -n Apache2.4 二.Apache web ...

  4. yum安装Apache Web Server后各个文件存放位置

    yum安装Apache Web Server后各个文件存放位置   用yum安装apache软件: yum -y install httpd 安装完成后,来查看理解yum安装软件的过程和安装路径.   ...

  5. kill 挂起 Apache Web Server

    [root@hadoop1 ~]# kill -l 1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL 5) SIGTRAP 6) SIGABRT 7) SIGBUS 8 ...

  6. 禁掉Apache web server签名 How to turn off server signature on Apache web server

    有的时候,我们为了从安全角度考虑,防止黑客恶意攻击.我们会隐藏掉server信息,比方,一般我们会发现例如以下信息. 我用的是centos (fedora, RHEL也一样) $ sudo vi /e ...

  7. XAMPP 1.8.2-2 Apache Web Server won't start, always stops immediately

    sudo apachectl stop apachectl是Apache超文本传输协议服务器的前端程序. 其设计意图是帮助管理员控制Apachehttpd后台的功能. MacOS中安装完Apache之 ...

  8. Windows环境下,将Django部署到Apache Web Server

    在Windows上部署Django(用mod_wsgi)会出现各种奇怪的问题,现简单记录下配置过程及遇到的错误及解决方法. 环境搭建                                   ...

  9. What is the difference Apache (Http Server) and Tomcat (Servlet Container)

    The Apache Project The Apache Project is a collaborative software development effort. Its goal is to ...

随机推荐

  1. angularjs 利用filter进行表单查询及分页查询

    页面: <div> <input style="width:90%;margin-left:5px;margin-right:5px;" class=" ...

  2. 《find技巧》-“linux命令五分系列”之一

    一天一个命令,做个记录, 我要成大神,哈哈哈 本原创文章属于<Linux大棚>博客. 博客地址为http://roclinux.cn. 文章作者为roc 希望您能通过捐款的方式支持Linu ...

  3. OS X Yosemite下安装Hadoop2.5.1伪分布式环境

    最近开始学习Hadoop,一直使用的是公司配好的环境.用了一段时间后发现对Hadoop还是一知半解,故决定动手在本机上安装一个供学习研究使用.正好自己用的是mac,所以没啥说的,直接安装. 总体流程 ...

  4. [转] 使用CSS3 will-change提高页面滚动、动画等渲染性能 ---张鑫旭

    一.先来看一个例子 下面这个例子来自某外文,我这里简单转述下. 视差滚动现在不是挺流行的嘛,然后Chris Ruppel当其使用background-attachment: fixed实现背景图片不随 ...

  5. Centos6.2_(64位)服务器环境配置:源码编译Nginx

    目标软件都指定安装目录:/apps.由于Nginx可以使用正则表达式来匹配访问路径, 要正常使用此功能就保证安装有Pcre库,如果你已经接着上一篇操作过来,就可以不用考虑这一点,因为此库已经在安装列表 ...

  6. linux c静态链接库与动态链接库

    库函数是我们编程的时候经常用到的,我们协作编程的时候可以将常用的函数封装成库供大家使用,这样能够提高大家的工作效率.对于库函数,它分为动态链接库和静态链接库.对于静态链接库我们必须是连接到可执行文件中 ...

  7. android的padding和margin的区别

    android:padding和android:layout_margin的区别:padding是站在父view的角度描述问题,它规定它里面的内容必须与这个父view边界的距离. margin则是站在 ...

  8. Idea设置自动导包

    默认 IntelliJ IDEA 是没有开启自动 import 包的功能.  勾选标注 1 选项,IntelliJ IDEA 将在我们书写代码的时候自动帮我们优化导入的包,比如自动去掉一些没有用到的包 ...

  9. uitextfield动态限制输入的字数-b

    1.定义一个事件: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 ...

  10. 2013 年 —— Facebook 在开源方面的工作介绍

    自从 Facebook 的第一行PHP代码,第一句 MySQL 的 INSERT 语句,开源就已经是我们工程哲学中的一个重要的部分. 现在,我们使用.维护并为大量的主要项目做出了贡献——涉及多种领域如 ...