OCPsoft

JBoss Application Server 7 on Port 80 with Apache HTTPd ProxyPass

January 9th, 2012 by Lincoln Baxter III

It’s quite simple really. All you need to do is install Apache HTTPd, then set make sure you have a few modules installed and set up:

Instructions below are for Ubuntu, Fedora, RHEL, or other Linux distributions. The results of this configuration can be seen at scrumshark.com, our latest open-source project management software initiative. We’re looking for contributors! (that means you.) So please come get involved! We are looking for help with the front-end graphical design and widgets like charts, graphs, and visualizations (or anything you are interested in.)

So what are you waiting for? Let’s get our JBoss / Apache love on.

The 9 steps to proxy success!

  1. Install Apache2.
  2. sudo a2enmod proxy
  3. sudo a2enmod proxy_http
  4. sudo a2enmod vhost_alias
  5. sudo a2dissite default (only if you are not using this site, or haven’t made changes to it)
  6. Create a file called jboss-as in /etc/apache2/sites-available:


    <VirtualHost *:80>
       ServerAdmin admin@site.com
       ServerName site.com
       ProxyRequests Off
       <Proxy *>
          Order deny,allow
          Allow from all
       </Proxy>
       ProxyPreserveHost on
       ProxyPass / http://localhost:8080/
    </VirtualHost>
  7. sudo a2ensite jboss-as
  8. Make sure your JBoss AS 7 instance is running on port 8080, and is accepting connections from localhost.
  9. sudo /etc/init.d/apache2 restart -or- service apache2 restart

In summary

That’s it! Your JBoss AS 7 instance should now be available on Port 80. You can, of course, make further customizations to this configuration; it is merely a bare minimal example in order to get up and running.

As always, I hope this has been helpful. Please let me know how it works for you!

Post to Twitter Post to Delicious Post to Digg Post to StumbleUpon

Posted in JBoss, OpenSource

8 Comments

  1. Markus says:

    Hi Lincoln,

    thanks for the post. What exactly are you doing with step 7?
    If you are trying to run JBoss with an unprivileged user, you should (and can!) skip this step.

    Thanks,
    M

    1. Hey Markus! Step seven enables the Apache configuration that we just created. I don’t think it would work without this step! How would you get around it?

  2. Fabio says:

    Hi Lincoln,
    thanks for the post!
    Your instruction works well on Ubuntu/Debian but for Fedora/CentOS/RHEL the procedure is sliglty different because you don’t have de command a2enmod and you don’t have the directory /etc/apache2/sites-available.
    On Fedora/Centos/RHEL you have to copy the file jboss-as under /etc/httpd/conf.d and restart apache

    Cheers!

  3. gUNASEKHAR says:

    Can You Please help me in implementing Https in Jboss 7

  4. Jon says:

    This is a great way to expose any appserver on port 80.
    I usually also use ProxyPassReverse and ProxyPassReverseCookiePath, any reason you omitted these?

    1. Hey Jon! Good to hear from yuo :) I hope all is well. I didn’t omit them for any other reason than I didn’t know about them. Care to explain?

      1. Jon says:

        All is well here :)

        I’m no Apache expert, but as far as I know, ProxyPassReverse should be added to make sure http redirects are rewritten correctly. But I know there is discussions about using it (hence my asking you).

        The ProxyPassReverseCookiePath rewrites cookie paths, i.e you have a webapp at /my-app but run Apache on / , the browser will not accept your cookies because they are only valid for /my-app. I see in your example you are just using / so there would be no need for this here :)

  5. Gunasekhar says:

    JBoss Application Server 7 on Port 443 with Apache HTTPd ProxyPass

Leave a Comment




Please note: In order to submit code or special characters, wrap it in

[sourcecode lang="xml"][/sourcecode]
(for your language) - or your tags will be eaten.

Please note: Comment moderation is enabled and may delay your comment from appearing. There is no need to resubmit your comment.

Get updates from OCPSoft



Add OCPsoft to your Circles

Read Something New

Join the Discussion

Blatant Advertising

Meta