Creating reverse proxy with appache is quite easy. The common scenario is that you want to redirect entire domain to internal application server.
Steps:
1) install apache
2) Edit APACHE_HOME/conf/httpd.conf with following content:
Listen 80
#Listen 1080
LogLevel debug
#ProxyHTMLLogVerbose On
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule xml2enc_module modules/mod_xml2enc.so
LoadModule proxy_html_module modules/mod_proxy_html.so
LoadModule deflate_module modules/mod_deflate.so
<VirtualHost *>
ProxyRequests OFF
ProxyPreserveHost On
ProxyPass / ajp://127.0.0.1:8009/
ProxyPassReverse / ajp://127.0.0.1:8009/
#ProxyPass /app/ ajp://127.0.0.1:8009/app/
#ProxyPass /app/ ajp://127.0.0.1:8009/app/
#ProxyHTMLURLMap / /app/
</VirtualHost>
3) On the application server (Tomcat/JBoss) deploy your app in the root context. For JBoss use jboss-web.xml with following content:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<context-root>/</context-root>
</jboss-web>
Also do not forget to disable the default root application from JBOSS_HOME/standalone/configuration/ set enable-welcome-root to false
<virtual-server name="default-host" enable-welcome-root="false">
No comments:
Post a Comment