This blog entry is the third and last part of the series „Create APEX in AWS“. Here I describe the installation and configuration of Apache Tomcat and the deployment of the ORDS application in Tomcat. Later I will explain the installation of the Webserver Nginx and configure it to access APEX via Apache Tomcat and ORDS.

Information about the installation of the APEX application in AWS can be found here. The installation and configuration of Oracle Data rest service is described  here.

Installation Apache Tomcat on the EC2 Container

As root: Download and extract the software:

[root@]# cd /usr/local

[root@]# wget

[root@]# tar -xvf apache-tomcat-9.0.20.tar.gz

[root@]# mv apache-tomcat-9.0.20 tomcat9

Create the Linux Service for the Tomcat. It is necessary for the automatically start and stop of the Tomcat by the Server reboot. Create the File tomcat.service:

[root@@]# vi /etc/systemd/system/tomcat.service



Description=Apache Tomcat Web Application Container






Environment=’CATALINA_OPTS=-Xms512M -Xmx1G‘











*Note: for the production environment the tomcat should be started from non-privileged user! In my test case I will start and top the tomcat as the user root.

Enable Service tomcat and start it:

[root@]# systemctl enable tomcat

[root@]# systemctl start tomcat

Check if Tomcat is running and accessible from the Browser:

Configure Apache Tomcat for the access APEX via Oracle Rest Data Service (ORDS)

Copy the Java binary ords.was and apex images into Tomcat directory:

[root@]# cp /home/apexuser/ORDS/ords.war /usr/local/tomcat9/webapps/

[root@]# mkdir /usr/local/tomcat9/webapps/i

[root@]# cp -Rf /home/apexuser/apex/images/* /usr/local/tomcat9/webapps/i

Change the permissions for the ORDS Directory for the user tomcat (created during the tomcat installation):

As root:

[root@]# chmod -R 777 /home/apexuser/ORDS/ords/conf/

Restart the Apache Tomcat:

[root@]# systemctl restart tomcat

Test the access to APEX via Apache Tomcat:

It works!

Install Nginx HTTP Server:

[root@]# amazon-linux-extras install nginx1.12

[root@]# systemctl enable nginx

[root@]# systemctl start nginx

Check the availability of nginx in Browser:

Configure Nginx to forward requests from Tomcat-ORDS-APEX

Check the Public Hostname/IP Address of the EC2 Container in the AWS Console:

Create the Cache Directory:

[root@]# mkdir -p /var/cache/nginx/one

Create the File default.conf.

[root@]# vi /etc/nginx/conf.d/default.conf

File Content:

proxy_cache_path /var/cache/nginx/one levels=1:2 keys_zone=one:128m;

server {

listen 80;

listen [::]:80;

server_name ;

proxy_cache one;

location / {

proxy_set_header X-Forwarded-Host $host;

proxy_set_header X-Forwarded-Server $host;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;




Save the file and check the nginx configuration:

[root@]# nginx -t


nginx: the configuration file /etc/nginx/nginx.conf syntax is ok

nginx: configuration file /etc/nginx/nginx.conf test is successful

Reload nginx configuration:

[root@]# nginx -s reload

Test Apex via Nginx (Port 80):

http://<Public IP of EC2 Container>/ords/

It works!!!

Previously Blog posts in this series:


Alle Beiträge von Neselovskyi, Borys

Borys Neselovskyi is a leading Infrastructure Architect at OPITZ CONSULTING - a German Oracle Platinum Partner. Since Februar 2019 he is an Oracle ACE. Borys field of work includes the conceptual design and implementation of infrastructure solutions based on Oracle Database/Middleware/Engineered Systems/Virtualization. He is also a frequent speaker at conferences (with live demos about Oracle software, sessions, panels, etc.).

Schreibe einen Kommentar