20110616 getting ohs to listen on port 80 - plembo/onemoretech GitHub Wiki

title: Getting OHS to Listen on Port 80 link: https://onemoretech.wordpress.com/2011/06/16/getting-ohs-to-listen-on-port-80/ author: lembobro description: post_id: 28 created: 2011/06/16 11:32:27 created_gmt: 2011/06/16 11:32:27 comment_status: open post_name: getting-ohs-to-listen-on-port-80 status: publish post_type: post

Getting OHS to Listen on Port 80

Getting Oracle HTTP Server to listen on port 80 involves a little trick that’s actually in the product FAQ (see question 1.7). Of course our friend at Online Apps DBA has a much nicer presentation, complete with circles and arrows and other graphical aids. I “re-learned” how to do this while helping out my friends Anil and Prakash on a project today (our buddy James helped in diagnosing the issue). See below for a summary. Basically this is a two step affair. Before you begin, make sure nothing else is already listening on port 80:

netstat -an | grep -i listen

If you see something is, find out what with this command:

lsof -i :80

In some cases the system httpd server may have been left on by accident (this would be indicated by finding the owner of port 80 to be “/usr/sbin/httpd”). Assuming it isn’t being used for anything important (be sure to ask), you will need to take it down to get OHS listening on port 80. On Red Hat Enterprise systems this means doing a “/etc/init.d/httpd stop” and a “/sbin/chkconfig httpd off” (to make sure it doesn’t start up again on the next reboot). Once you’ve done the obligatory “opmnctl stopall” for the OHS server, follow this procedure: 1. Change ownership of the .apachectl (that’s the DOT apachectl file, not the regular one) under $ORACLE_HOME/Apache/Apache/bin to setuid root, thus:

cd $ORACLE_HOME/Apache/Apache/bin
chown root .apachectl
chmod 6750 .apachectl

2. Edit httpd.conf to replace the port designations in the file, or to add the appropriate “Listen 80” and “VirtualHost” statements if you need to continue listening on multiple ports (note that the “Port” directive that you see in older OHS versions based on Apache 1.3 was deprecated in Apache 2, and so should not be used in later OHS configurations).

Listen 7779
Listen 80

. . .


. . .



. . .

If you’re servicing multiple IP based Virtual Hosts from the same server be sure to direct the server to listen on the desired IP (keep in mind that the server is capable of listening on the same address using multiple ports), for example:

Listen 10.1.0.23:7779
Listen 10.1.0.25:80
. . .


. . .



. . .

Do an “opmnctl startall” when this is done to see the change take effect. Note: Over time Oracle has done an excellent job obscuring what version of Apache a given OHS release is based on. If you want to know if your OHS install is Apache 1.3 or Apache 2 based, go to the OHS bin directory and run “./httpd -V”. You may need to source the Apache libraries for this, invoking something like “export LD_LIBRARY_PATH=$OH/Apache/Apache/lib:$LD_LIBRARY_PATH” (different releases of OHS use different paths, another variation would be “$OH/ohs/lib”). An OHS release based on Apache 2 will have the line “-D HTTPD_ROOT=”$(APACHE2_HOME)”". One based on Apache 1.3 will not. Additional Note: There’s a whole separate discussion that could be had about whether IP address based virtual hosts make sense any more, now that all modern browsers are able to properly negotiate name virtual hosts. One question that would need to be addressed in an Oracle Applications, or any other third party application software, environment is if the application code that might need to do HTTP can handle name based virtual hosts. Results have been mixed in my experience, unfortunately. Of course when there’s a need for the web server to do HTTPS and you don’t have an intervening load balancing device to deal with it, IP based virtual hosting is usually unavoidable.

Copyright 2004-2019 Phil Lembo