This is post 7 in the Fully Freeware APEX environment series. The post will cover the configuration of the Oracle HTTP server.

Please mention, that I’m not fully aware about the license restrictions on the Oracle HTTP server. What I heard is that if you use it for an APEX installation and install it physically on the same box as the Oracle database server there is no license fee. But please correct me if I’m wrong.

Information has been taken from

  • The APEX installation guide

Unlocking the APEX public user account

Unlocking and chinging its password:

connect system
alter user apex_public_user account unlock;
alter user apex_public user identified by secret_password;

Unzip the apex distribution

I may have a crazy directory structure, but this is what I understood from the Oracle standards:

su
mkdir -p /u01/app/oracle/product/4.0.2/
chmod 777 /u01/app/oracle/product/4.0.2/
unzip apex_4.0.2.zip -d /u01/app/oracle/product/4.0.2/

Loading the mod_plsql module

Loading the mod_plsql module into the (apache) server is as easy as editing a text-file. The key off-course is what text to edit:

If you used the directory I proposed in step VI, then the httpd.conf should be edited as follows:

su
export OHS=/u01/app/oracle/product/11.1.1/ofm
gedit $OHS/Oracle_WT1/instances/instance1/config/OHS/ohs1/httpd.conf

Add these lines at the end of the file:

LoadModule plsql_module "${ORACLE_HOME}/ohs/modules/mod_plsql.so"
include /u01/app/oracle/product/11.1.1/ofm/Oracle_WT1/ohs/conf/mod_plsql/*.conf

Save the file.

Configure the dads.conf

The dads.conf holds the information apex uses to log in into the database. Open it and edit:

gedit /u01/app/oracle/product/11.1.1/ofm/Oracle_WT1/ohs/conf/mod_plsql/dads.conf

The file should look like this:

# ============================================================================
#                     mod_plsql DAD Configuration File
# ============================================================================
# 1. Please refer to dads.README for a description of this file
# ============================================================================ 

# Note: This file should typically be included in your plsql.conf file with
# the "include" directive.

# Hint: You can look at some sample DADs in the dads.README file

# ============================================================================ 

Alias   /i/               "/u01/app/oracle/product/4.0.2/apex/images/"
AddType text/xml          xbl
AddType text/x-component  htc

<Location /apex>
 Order                          deny,allow
 PlsqlDocumentPath              docs
 AllowOverride                  None
 PlsqlDocumentProcedure         wwv_flow_file_manager.process_download
 PlsqlDatabaseConnectString     localhost:1521:XE ServiceNameFormat
 PlsqlNLSLanguage               AMERICAN_AMERICA.AL32UTF8
 PlsqlAuthenticationMode        Basic
 SetHandler                     pls_handler
 PlsqlDocumentTablename         wwv_flow_file_objects$
 PlsqlDatabaseUsername          APEX_PUBLIC_USER
 PlsqlDefaultPage               apex
 PlsqlDatabasePassword          parsingschemapasswd
 PlsqlRequestValidationFunction wwv_flow_epg_include_modules.authorize
 Allow from all
</Location>

Please have a look and correct the following directives:

  • PlsqlDatabaseConnectString
  • PlsqlDatabasePassword (pay attention. case is important)

Now we must (re-)start the OHS:

su
ln -s /u01/app/oracle/product/11.1.1/ofm/Oracle_WT1/instances/instance1/bin/opmnctl /bin/opmnctl
exit
opmnctl stopall
opmnctl startall

This piece of script also creates a symbolic link in /bin/ to the OHS management program “OPMNCTL”. We will use this later on to make OHS start automatically.

Automating the startup process

We’d like the OHS to start automatically when the server boots.

Create a file /etc/init.d/ohs

#!/bin/bash
#
# chkconfig: - 91 35
# description: Starts and stops Oracle HTTP Server. 

# Source function library.
. /etc/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

prog=$"Oracle HTTP server"

start() {
    echo -n $"Starting $prog: "
    /bin/opmnctl startall>nul:
}

stop() {
    echo -n $"Shutting down $prog: "
    /bin/opmnctl stopall>nul:
}
status() {
    /bin/opmnctl status
}

# See how we were called.
case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  restart|reload)
	stop
        echo ""
	start
        echo ""
	;;
  status)
	status
	;;
  *)
	echo $"Usage: $0 {start|stop|restart|status}"
	exit 1
esac

Now the server is controllable by:

  • /etc/init.d/ohs start
  • /etc/init.d/ohs stop
  • /etc/init.d/ohs restart
  • /etc/init.d/ohs status

This can then be easily be automated:

su
/sbin/chkconfig --add ohs
/sbin/chkconfig ohs on

Et voila! we’re be able to restart the box. OHS should now start automatically.

Obfuscating the password in dads.conf

Plain text passwords in plain textfiles is obviously not a good idea. The password in dads.conf can be obfuscated as follows:

6 thoughts on “Fully freeware APEX environment VII: Oracle HTTP server (configuration)

  1. Hi,
    first of all congratz, and thank you, on the how-to it was very helpfull to me.

    I would like to know if you implemented mod_deflate in this instance, I’ve been trying to activate it but despite everything apears in good state the compression is not being done.

    Note: the article above is being cutted before the explanation of how you should obfuscate your password, at least for me it is. The last phrase I see is:
    “Plain text passwords in plain textfiles is obviously not a good idea. The password in dads.conf can be obfuscated as follows:”

    Regards,
    Alexandre.

    Reply
    • Yes, it’s oooold question. But what’s wrong with mod_deflate? I’ve successed with it on WS 2008 x64 by the way. And one more thing is that WebCache use it by default. It concerns Oracle WebTier product 11 1 0 6 (OHS+WebTier+OPMN).

      Reply
  2. We have SCCM 2007 with 11.000 clients and many DPs, PXE svciere points, etc. virtualized (except the database which is not virtualized because of VMware licensing costs, it has 32GB of RAM, it would consume too much from one host) and it works very well. Maybe it wouldn’t work on well HyperV :).I/O requirements are quite low, ~200 IOPS during normal usage (the management point and primary site server are on different VMs).CPU usage is also moderate, I see spikes to ~30%, average 5% out of 5 vCPUs (2 for MP, 3 for primary site server).

    Reply

Leave a Reply