Wednesday, August 06, 2014

Configuring Oracle HTTP server to run on port 80

A very common requirement for most implementations is that the web servers run on port 80, that way the users don't have to type the port in the URL, usually after installing Oracle Web Tiers, the apache server runs on port 7777.

One way to address this is to do a port translation at the LB level, but apache can and usually run on port 80, the only change to the system is that as port 80 is a protected port, the apache demon needs to be run as root.

The first this to do is change the Listen port of the web tier from the default 7777 to 80. This can be done by modifying the httpd.conf file located under the instance home ($MW_HOME/Oracle_WT1/instances/instance1/config/OHS/ohs1)

1. Stop the web tier

$MW_HOME/Oracle_WT1/instances/instance1/bin/opmnctl stopall
2. Edit the httpd file

Look for the Listen key and set it to 80
# OHS Listen Port
Listen 80
Additionally, check that the user and group settings in the same config document are correct (sometimes they can be commented out). These settings are use to switch to the oracle owner after starting the system as root.

User oracle
Group oinstall

3. if you have any Virtual Host that you want to run on port 80 too, change the virtual host configuration too, for example, in my system I have a separate configuration file under the moduleconf folder (all files in this folder are added to the httpd.conf as includes), some other configurations may have this configuration directly on the httpd.conf file

NameVirtualHost *:80
<virtualhost>

    ServerName myportal.com:80

    ServerAdmin you@your.address

    RewriteEngine On

    RewriteOptions inherit
</virtualhost>

After modifying the configuration files we need to make the change to the apachectl demon so it runs as root

1. Login as the root user and go to the bin directory for the WebTier home

cd $MW_HOME/Oracle_WT1/bin

2. change the owner of the file to root (please note that the file starts with a "." as it is a system file) and the permissions so it can be executed by the opmnctl tool
chown root .apachectl
chmod 6750 .apachectl

3. login as the Oracle owner and start the web tier

$MW_HOME/Oracle_WT1/instances/instance1/bin/opmnctl stopall

You should now be able to access the site on port 80.

No comments: