JBoss Application Server 7 on Port 80 with Apache HTTPd ProxyPass
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. So what are you waiting for? Let’s get our JBoss / Apache love on.
The 9 steps to proxy success!
- Install Apache2.
sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2enmod vhost_alias
sudo 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 firstname.lastname@example.org 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 summaryThat’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!
Posted in JBoss, OpenSource
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.
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?
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
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
I’m new to infra & jboss configuration. I have been trying above steps on Ubuntu. Im facing issue from step 5.
step5: error: site default does not exist.
step6: created jboss-as file as mentioned(without changing anything)
step7: error: site jboss-as does not exist.
step8: error:AH00558: apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1. Set the ‘ServerName’ directive globally to suppress this message