Part 4: Configure APEX with ORDS, Apache-Tomcat und Nginx

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@<ec2-container>]# cd /usr/local

[root@<ec2-container>]# wget

[root@<ec2-container>]# tar -xvf apache-tomcat-9.0.20.tar.gz

[root@<ec2-container>]# 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@@<ec2-container>]# 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@<ec2-container>]# systemctl enable tomcat

[root@<ec2-container>]# 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@<ec2-container>]# cp /home/apexuser/ORDS/ords.war /usr/local/tomcat9/webapps/

[root@<ec2-container>]# mkdir /usr/local/tomcat9/webapps/i

[root@<ec2-container>]# 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@<ec2-container>]# chmod -R 777 /home/apexuser/ORDS/ords/conf/

Restart the Apache Tomcat:

[root@<ec2-container>]# systemctl restart tomcat

Test the access to APEX via Apache Tomcat:

It works!

Install Nginx HTTP Server:

[root@<ec2-container>]# amazon-linux-extras install nginx1.12

[root@<ec2-container>]# systemctl enable nginx

[root@<ec2-container>]# 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@<ec2-container>]# mkdir -p /var/cache/nginx/one

Create the File default.conf.

[root@<ec2-container>]# 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 <Public Servername or Ip Address of EC2>;

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@<ec2-container>]# 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@<ec2-container>]# nginx -s reload

Test Apex via Nginx (Port 80):

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

It works!!!

Previously Blog posts in this series:

Kommentar verfassen

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.

%d Bloggern gefällt das: