Skip to main content

Oracle ORDS and Apache

Before using ORDS, you need a database and APEX. Go here to do that. Download ORDS at Oracle.

Installation of ORDS

The Oracle Rest Data Services (ORDS) installation consists of unzipping the downloaded archive, running the configuration command, then deploying. This setup is going to run ORDS in standalone mode with Apache HTTP to proxy requests.

As oracle user.

Download the ORDS zip to /tmp.

Extract the installer.

cd /tmp
mkdir -p /u01/ords
unzip ords-20.*.zip -d /u01/ords

Make a backup of the original properties file

mv /u01/ords/params/{ords_params.properties,ords_params.properties.orig}

Create a ords_params.properties file.

cat > /u01/ords/params/ords_params.properties <<EOF 
db.hostname=ora19c.core.example.com
db.port=1521
db.servicename=pdb1
db.sid=cdb1
db.username=APEX_PUBLIC_USER
db.password=Som3bTt3rpwd
migrate.apex.rest=false
plsql.gateway.add=true
rest.services.apex.add=true
rest.services.ords.add=true
schema.tablespace.default=SYSAUX
schema.tablespace.temp=TEMP
standalone.mode=true
standalone.use.https=true
standalone.http.port=8080
standalone.static.path=/home/oracle/apex/images
user.apex.listener.password=Som3bTt3rpwd
user.apex.restpublic.password=Som3bTt3rpwd
user.public.password=Som3bTt3rpwd
user.tablespace.default=APEX
user.tablespace.temp=TEMP
sys.user=SYS
sys.password=Som3bTt3rpwd
restEnabledSql.active=true
feature.sdw=true
database.api.enabled=true
EOF

Change to the ords directory and start the standalone instance.

cd /u01/ords
$JAVA_HOME/bin/java -jar ords.war standalone

Configuration of Apache httpd to map ORDS

The last step is to configure Apache to map HTTP-requests to ORDS and therefore APEX engine.

For this, add a custom httpd configuration file. By default, every .conf file placed in the etc/httpd/conf.d/ directory is read by httpd as an additional configuration file to the main /etc/httpd/conf/httpd.conf config file.

Create the apex.conf file in the etc/httpd/conf.d/ directory with the contents as below:

# proxy ORDS 
<VirtualHost *:80>
    # ServerName example.com
    # ServerAlias www.example.com
    
    # alias for APEX static files
    Alias "/i" "/var/www/apex/images/"

    # uncomment the line below if you want 
    # to redirect traffic to ORDS from root path
    # RedirectMatch permanent "^/$" "/ords"

    # proxy ORDS requests to tomcat
    ProxyRequests off
    <Location "/ords">
        ProxyPass "https://localhost:8443/ords"
        ProxyPassReverse "https://localhost:8443/ords"
    </Location>
</VirtualHost>

Tell SELinux (Yes, that should be running) to allow Apache to communicate to ORDS.

setsebool httpd_can_network_connect on