Sunteți pe pagina 1din 12

IBM India Ltd.

Server Inventry ScriptManual

May 11, 2012

PAGE 1

Table of Contents
1 Overview 2 Audience 3 What is Reverse Proxy Server 4 Prerequisite 4.1 Apache Web server 1.3.27 or 2.2.x 4.2 Sun One Application Server Version 7 4.3 C Compilers to compile Apache 4.4 LibXML version 2 5 Apache 1.3.x Configuration 6 SUN One Configuration 7 Apache 2.2.x Configuration 8 Log Monitoring 4 5 6 7 7 7 7 7 8 9 10 12

Date May 7, 2012

Version Author(s) 1.0 Anurag Sharma

Revision History

Summary of Changes Initial Version

Overview
This document provides details of setting up Apache web server on UNIX operating system as reverse proxy for Sun One Application server.

Audience
This document is indented to system administrators with UNIX skills to configure Apache webserver as a reverse proxy for Sun One Application Server.

What is Reverse Proxy Server


A reverse proxy is a proxy server that is installed within the neighborhood of one or more servers. Typically, reverse proxies are utilized in front of web servers. All connections coming from the Internet addressed to one of the web servers are routed through the proxy server, which may either deal with the request itself or pass the request wholly or partially to the main web servers. A reverse proxy dispatches in-bound network traffic to a set of servers, presenting a single interface to the caller. For example, a reverse proxy could be used for load balancing a cluster of web servers. In contrast, a forward proxy acts as a proxy for out-bound traffic. For example, an ISP may use a proxy to forward HTTP traffic from its clients to external web servers on the internet; it may also cache the results to improve performance.

4
4.1

Prerequisite
Apache Web server 1.3.27 or 2.2.x Sun One Application Server Version 7 C Compilers to compile Apache LibXML version 2

4.2 4.3 4.4

Apache 1.3.x Configuration


Apache 1.3.27 is an archived version so it has to be downloaded from: http://archive.apache.org/dist/httpd/apache_1.3.27.tar.gz Un tar the downloaded bundle and compile with the following options #./configure --enable-module=proxy --prefix=/usr/local/apache # make # make install Now edit the Apache configuration file # vi /usr/local/apache/conf/httpd.conf Add the following to the httpd.conf file <IfModule mod_proxy.c> ProxyPass / http:// <IP Address Of Appserver>:<Port>/ ProxyPassReverse / http:// <IP Address Of Appserver>:<Port>/ </IfModule> Start Apache # /usr/local/apache/bin/apachectl start Stop Apache # /usr/local/apache/bin/apachectl stop

SUN One Configuration


The configuration and behavior of the web server plug-in are determined by a set of configuration files. Sun ONE Application Server looks at the configuration defined in these files each time it processes a request from a client. The configuration files are named obj.conf and init.conf. Each instance of Sun ONE Application Server has its own init.conf file, to which the server refers at startup. The obj.conf file is essential to the operation of the Sun ONE Application Server. When you make changes to the server through the Administration interface, the system automatically updates obj.conf. The init.conf configuration file sets values of variables that configure the server during initialization. The server executes the configuration parameters specified in this file, during server start up. Edit the obj.conf of your app server instance and add the following lines: vi /var/opt/domains/domain_name/config/obj.conf

# Entries for Reverse Proxy


<Object name="default"> AuthTrans fn="match-browser" browser="*MSIE*" ssl-unclean-shutdown="true" AuthTrans fn="auth-pass through" fn="service-passthrough" servers="http://IPAddress of the app server:PORT" Error reason="Bad Gateway" fn="send-error" uri="$docroot/badgateway.html" </Object>

Locate the libpassthrough.so file on the server and add to load modules Edit the init.conf of your app server instance and add the following lines: # Entries for Reverse Proxy
Init fn="load-modules" shlib="/usr/appserver/lib/libpassthrough.so" funcs="initpassthrough,auth-passthrough,check-passthrough,service-passthrough" NativeThread="no" Init fn="init-passthrough"

Restart the Application Server Instance /var/opt/domains/domain_name/bin/restartserv

Apache 2.2.x Configuration


On the web Server Download the latest apache UNIX source from: http://httpd.apache.org/download.cgi Download the proxy_html module for apache from: http://apache.webthing.com/mod_proxy_html/mod_proxy_html.tgz Extract the downloaded apache into a directory and compile: # ./configure --prefix=/usr/local/apache2 --enable-deflate --enable-proxy --enable-proxy-balancer --enable-rewrite --enable-headers # make # make install Extract mod_proxy_html.tgz file and move it to /usr/local/apache2 # tar -zxvf mod_proxy_html.tgz # mv mod_proxy_html.c /usr/local/apache2 Optional: create a soft link for libxml in /usr/include for mod_proxy module # ln s /usr/include/libxml2/libxml /usr/include/libxml Compile and add the mod_proxy_html module to apache #. /apxs -c -i /usr/local/apache2/mod_proxy_html.c Edit the apache configuration file httpd.conf # vi /usr/local/apache2/conf/httpd.conf Add the below entries to the end of the httpd.conf file: Include /usr/local/apache2/proxy_html.conf

<VirtualHost *:80> ServerName <hostname of the server where apache is hosted> DocumentRoot <Path where the static content is placed on the web server> ProxyPass /<APPNAME> http://<IP Address Of Appserver>:<Port>/<APPNAME> ProxyPassReverse /<APPNAME> http://<IP Address Of Appserver>:<Port>/<APPNAME> ProxyPreserveHost on </VirtualHost>

10

Ensure you copy the required static content to the web server Edit proxy_html.conf to load the proxy_html module # vi /usr/local/apache2/proxy_html.conf Uncomment the following entries: LoadFile /usr/lib/libxml2.so LoadModule proxy_html_module Save the file and start the web server To Start the apache2 web server # /usr/local/apache2/bin/apachectl start To Stop the apache2 web server # /usr/local/apache2/bin/apachectl stop To Re-start the apache2 web server # /usr/local/apache2/bin/apachectl restart Verify the access from a browser http://<IP Address of the web server/application path>/ modules/mod_proxy_html.so

11

Log Monitoring
Look for errors in the SUN One Server logs while restarting # tail f /var/opt/domains/domain_name/logs/server.log Look for apache 1.3 errors in the apache log file # tail f /usr/local/apache/logs/error.log Look for apache 2 errors in the apache log file # tail f /usr/local/apache2/logs/error.log

12

S-ar putea să vă placă și