Hello guys ! Recently our site faced a crash and we couldn’t restore it from backups. So, we have lost our previous posts and now we are going start fresh. Though, event was unfortunate but it gave us a lesson for maintenance and operations of a site.

Life is learning 🙂 So, let's go again.

Today, we will discuss how to Set Up Apache as Reverse Proxy Server for JBoss Enterprise Application Server (EAP).

Steps

1. First step is to check if Apache 2 is installed on your Linux System which you are going to use as Reverse Proxy Server or not. Run following command on your terminal and if it shows something as below, it means Apache 2 is installed on your system.

1

 

2. If Apache 2 is not installed, first install it on your system. Click here to Apache 2 installation guide.

3. Next step is to configure your copy of Apache so that it includes the mod_proxy module, by using the following directives in your httpd.conf file.

4. httd.conf file can be found mostly at location /etc/httpd/conf/httpd.conf. But, if its not there you can use locate command to find it on file system as follows:

2

5. Add following line to load mod_proxy module with Apache.

LoadModule proxy_module modules/mod_proxy.so

e.g.

3

6. Now, include two directives in your httpd.conf file for each web application that you wish to forward to JBoss Web.

ProxyPass /<context_path_of_your_application>
http://<ip_of_jboss_application_server>:<jboss_http_port>/<context_path_of_your_application>
ProxyPassReverse /<context_path_of_your_application> http://<ip_of_jboss_application_server>:<jboss_http_port>/<context_path_of_your_application>

e.g.

4

7. Restart Apache 2 by executing following command:

service htttp restart

or

/etc/init.d/httpd restart

8. Now, we need to configure Jboss Server with appropriate proxy settings:

For Jboss EAP add following snippet:

<connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http" proxy-name="<fully_qualified_domain_name_or_ip_of_reverse_proxy_server>" proxy-port="80"/>

5

Following snippet must be present in socket binding tag:

<socket-binding name="http" port="8080"/>

For Jboss Community Version add following snippet:

<connector port="8080" proxyName=fully_qualified_domain_name_or_ip_of_reverse_proxy_server” proxyPort="80"/>

9. Now start your Jboss Application Server.

10. Enter url for Reverse Proxy Server and you should be able to access your applciation.

e.g.

http://192.168.100.1:80/home

or

http://192.168.100.1/home {Because 80 is default port for Apache 2}

Note: Sometimes, you might face following error while trying to access your application:

Service Temporarily Unavailable

The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

To find its root cause, check error_log of Apache. Mostly, you can find these logs at /var/log/httpd/error_log location.

(13)Permission denied: proxy: HTTP: attempt to connect to <jboss_application_url> failed.

It happens because, by default httpd processes cannot initiate outbound network connections, so enable proxy permissions by executing following command:

/usr/sbin/setsebool httpd_can_network_connect 1

That’s it. We have configured our Apache 2 as Reverse Proxy Server for JBoss. Feel free to suggest any improvements.

How to use Apache as Reverse Proxy Server for JBoss Enterprise Application Server(EAP).

Leave a Reply

Your email address will not be published. Required fields are marked *