JBoss Application Server 7 on Port 80 with Apache HTTPd ProxyPass
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!
- Install Apache2.
sudo a2enmod proxysudo a2enmod proxy_httpsudo a2enmod vhost_aliassudo a2dissite default(only if you are not using this site, or haven’t made changes to it)- 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>
sudo a2ensite jboss-as- Make sure your JBoss AS 7 instance is running on port 8080, and is accepting connections from localhost.
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!
|
About the author:Lincoln Baxter, III is a Senior Software Engineer at Red Hat, working on JBoss open-source projects; most notably as project lead for JBoss Forge. This blog represents his personal thoughts and perspectives, not necessarily those of his employer. He is a founder of OCPsoft, the author of PrettyFaces and Rewrite, the leading URL-rewriting extensions for Servlet, Java EE, and Java web frameworks; he is also a member of the JavaServer™ Faces Expert Group. When he is not swimming, running, or playing Ultimate Frisbee, Lincoln is focused on promoting open-source software and making web-applications more accessible for small businesses, individuals. His latest project is SocialPM, an open-source, agile project management tool. |
Posted in JBoss, OpenSource
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
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?
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!
Can You Please help me in implementing Https in Jboss 7
This is a great way to expose any appserver on port 80.
I usually also use ProxyPassReverse and ProxyPassReverseCookiePath, any reason you omitted these?
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?
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
JBoss Application Server 7 on Port 443 with Apache HTTPd ProxyPass