How to get JBoss and Apache to work together

2009-12-10 下午5:05

How to get JBoss and Apache to work together

I have JBoss 5 loaded on a Win2k8 box along with Apache 2.2.14 and Coldfusion 9. I believe I'm having issues with Apache and JBoss not working together or set up correctly. What is the best way to set them up? I've read mod_jk is the way to go then others say mod_proxy. I've tried both but with no luck.

We use JRun on our production servers and are thinking of switching to JBoss. JRun is fairly easy to set up with Apache, just load the module and you're pretty much set. Is there an easy way to get these two working together?

I'm new to JBoss, thanks for any help :)

平均用户评价
(0 评价)
  • Robert FreundNewbie 22 发帖自 
    2009-11-29

    JBoss and Apache do play well together! Your on a Win box. So you probably have a setup similar to c:/jboss5 and c:/apache. Now you probably want to get jboss running (at least) forward listening on port 80. You are correct. Choose either mod_jk or mod_proxy. One way to do it.... there are many and your exact server limitations/ setup should be consulted to determine your best case scenario but for a point of getting started uncomment the mod_proxy modules... If they are not already there add them from apache...

    apache/conf/httpd.conf

    LoadModule proxy_connect_module modules/mod_proxy_connect.so
    LoadModule proxy_module modules/mod_proxy.so
    LoadModule proxy_http_module modules/mod_proxy_http.so
    


    and then to config it in apache/conf/httpd.conf do the following... Obviously this setup is very open ended and may not be optimal for proxy pass and such but will get jboss and apache to play nice. 

    apache/conf/httpd.conf 
    ProxyRequests Off
    ProxyPreserveHost On
     
    <Proxy *>
     Order deny,allow
     Allow from all
    </Proxy>
     
    ProxyPass / http://localhost:8080/
    ProxyPassReverse / http://localhost:8080/
    <Location />
     Order allow,deny
     Allow from all
    </Location>
    


    That should do it. Start apache and jboss and hit localhost at port 80. 

    Hope that helps.

  • Robert FreundNewbie 22 发帖自 
    2009-11-29

    A quick word on proxy vs ajp. I noticed some weird behavior myself when using mod_ajp as opposed to mod_proxy when it comes to jboss-native / APR and have found that mod_proxy seems to generally work more consistent. But if Comet / APR sort of setups is not the concern then ajp works flawlessly as well.

  • Robert FreundNewbie 22 发帖自 
    2009-11-29

    First check to make sure you are indeed listening on ports 80 and 8080. cmd>netstat -an. You should be listening on these ports.

    Also not sure about Coldfusion specifics but shouldn't your config for jboss-web exist in WEB-INF as opposed to web.inf...!

    Next I would check the root of Jboss on start. You should be able to bring up Welcome To JBoss from http://localhost. If that comes up then you know you are setup right and it's an application problem and not a jboss / apache problem. So remove your <context-root>/</context-root> and the app will live at the http://localhost/cfusion/.

    Also check nothing else is listening on those ports (other servers etc...).

    And lastly, make sure you indeed have those modules installed.

    You can add virtual-host to the jboss-web but generally you only need that if you have mutliple domains etc... so if you are accessing it from a different domain... ie devmktgweb.fullsail.com then add that virtual-host to your jboss-web.

    But first make sure jboss and apache work together... then drill down on your application specific setup.

    I see fullsail in your post above...! ROCK ON FULL SAIL!!!

  • Robert FreundNewbie 22 发帖自 
    2009-11-29

    In short.. yes... your files go in the cfusion.war

    Generally, you place your files in the directory (.war) you are creating. When you place a .war in jboss/server/default/ it will be registered as an application and accessible at the location unless you specify otherwise in the jboss-web.xml file. Every application has WEB-INF which is a standard java web application deployment descriptor folder where inside you'll have your web.xml. So your application context (in your case folder) would be http://localhost/cfusion. Now that gets us to the file. Your individual pages exist inside the .war which is your application on the server. So you would have a setup like:
    >cfusion.war
    >>WEB-INF
    >>CFIDE
    >>META-INF
    >>helloworld.cfm

    Any file you want to read should be in the application context. You generally don't need to and shouldn't point your apache docRoot at this folder. By forwarding to jboss, jboss-web is more then capable of handling the request. The DocRoot in the case of any app deployed in Jboss just won't be used - instead the application your working with will be targeted which is probably the desired behavior.


    So in your case here's how your setup should work.

    Apache with the proxy_mods installed. The directoryRoot of apache is irrelevant because you are not using it. Instead you are forwarding these requests onto your application. Your j2EE Web application is the cfusion.war. This gets targeted and picked up by requests to http://localhost because in your jboss-web.xml you told it to act on the root with : <context-root>/</context-root>.

    At this point your coldfusion server application is live at http://localhost. Now.. the actual Website Applications you intend to build will live inside this main cfusion.war directory... which is providing you coldfusion inside a standard J2EE application server. Place all your coldfusion files in the cfusion.war directory or subdirectory's.

    Hope that helps!

  • Robert FreundNewbie 22 发帖自 
    2009-11-29
    Yeah. You should add the server.xml hosts you indicated for each vhost. Generally.... you should use a seperate .war for each isolated site you are going to deploy. Context is important and if you're developing multiple isolated sites you should deploy each as a seperate war.
  • Robert FreundNewbie 22 发帖自 
    2009-11-29

    Might want to check this if you have not already. I see some things in there that may help.

    http://help.adobe.com/en_US/ColdFusion/9.0/Installing/WSc3ff6d0ea77859461172e0811cdec18c28-7fbd.html

  • erasmo2 marciano2Master 354 发帖自 
    2008-3-31

    You have a error here, in this line code

     

    ProxyPass / ajp://devmktgweb.mysite.com:8080/

     

    You are doing to work JBoss and Apache with ajp.

     

    The port of defaul ajp is 8009

     

    Try ProxyPass / ajp://devmktgweb.mysite.com:8009/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值