Monday, December 23, 2019

Free Oracle Cloud: 17. Configure domain to redirect to APEX app

This post is part of a series of blog posts on the Best and Cheapest Oracle APEX hosting: Free Oracle Cloud.

In a previous blog post, we configured the webserver on our Compute VM Instance. We added a website and configured the domain dgielis.com to point to this instance.

I got many requests on how to point the domain name to a specific Oracle APEX app. This is what I will cover in this blog post.

Lets start with connecting to our VM:

From a Terminal connect to your Oracle Cloud VM:

ssh -i ssh_key opc@public_ip

The first thing we do, is changing to the root user, as we want to configure the web server. Alternatively in front of every command you can add sudo.

We logged in as the OPC user, to become the ROOT user we do:

sudo su

# open the configuration file we created in the previous blog post
vi /etc/nginx/conf.d/dgielis.com.conf

# add following
  location / {
    rewrite ^/$ /ords/f?p=101:LOGIN_DESKTOP:0 permanent;
  }

# save and quit (:wq)

My config file looks now like this:


# to test Nginx configuration
nginx -t 

# to restart Nginx
nginx -s reload

That's it.

13 comments:

Bertil Tandayamo said...

Hi, Dimitri.
I know is nothing about with this blog, but anyways
could you help me with something,
What kind of business/companies have oracle apex as software architecture?.
Does also big tech companies like Facebook, Google use in some transactions?
How come this?, Because I've seen a lot of job alerts coming just from India, or Egypt. countries who are in the process of development and nothing from Europe or the US.

Thank you in advance for your answer.

Cheers,
Bertil Tandayamo

Dimitri Gielis said...

Hi Bertil,

There are many big companies using Oracle APEX. Some in automotive are Volkswagen and BMW, some in Pharma are Davita and Merck, you have companies like Siemens in industry and Harvard University in Education. In technology, you have Oracle themselves. I'm unsure about Google and Facebook, I guess they use their own systems and not Oracle APEX.
But hopefully, you can see that Oracle APEX is used across many domains with many different (big) companies.

When you look at apex.world you find jobs in US and Europe too. In fact, Germany is one of the biggest markets for Oracle APEX.

Hope that helps,
Dimitri

Bertil Tandayamo said...

Hi Dimitri, thanks a lot yeah I was underrating Oracle Apex power. Thank you again for the feedback, Cheers.

juanjf9 said...

Hi Dimitri, I want to thank you again for these post, I beleive you have more documentation about Oracle cloud then Oracle itself hehe.

Quick question, do you know what changes needs to be done at conf file in order to redirect to different databases with the same domain?.

like: mydomain.com/prod/ords
mydomain.com/dev/ords

Regards.

sumko said...

Hi Dimitri, i really want to thank you for making this series, it is really helpfull. I was able to follow it, up to mapping to specific apex app. Even though i added rewrite command as you instructed in domaind.conf file it still opens index.html (ssl is also activated, did everything you did). Any idea on this or maybe it simply needs some time to redirect.

Thanks

BR,
Sumi



shonjoyd said...

Hi Dimitry, first of all, thanks for all the blog posts. They are life savers! Please keep them coming.

I'm actually trying to setup to ATPs, one TEST and one DEV. The ATP setup is fine. However, I also want to have a single coumpute instance with nginx and route traffic to DEV or TEST based on the URL. For instance, myapp-test.mydomain.com should go to TEST apex, myapp-dev.mydomain.com should go to DEV apex. I've tried a few settings in the /etc/xginx/conf.d/com.mydomain.myapp.conf file, where I tried to replicate the server module, but when I try to run it by: nginx -t - it fails.

Any pointer would be highly appreciated. Thanks.

Kind regards,
Shonjoy

Unknown said...

Hi Dimitri !

Thanks for sharing this knowledge.
In the case of friendly url how would it be ?

Phil Winfield said...

This assumes the certbot aspect is working, on your previous posting it is the one aspect that doesn't seem to work!

If you get a chance please can you let us know how to resolve this :)

lina said...

hi Dimitri
I successfully completed the steps mentioned in your article, MY mydomain successfully pointed to the APEX login screen, but Autonomous Databases OCID is displayed on the web URL, maybe we can Configure Oracle REST Data Services to achieve the effect??

Regards.
Lina Chuang

Anonymous said...

Hi Dimitri,
Love your posts! Keep it up.

Previously we were able to restrict access to the APEX Builder by IP address by whitelisting IP addresses in the Instance settings. Now after we deployed NGINX this is not working.

Can you suggest how to restrict IP addresses to the APEX workspace builder when using NGINX as a reverse proxy? We need to not have the workspace login page publicly exposed.

Regards,
JB

Anonymous said...

Hi Dimitri,
How do you restrict access by IP address to the APEX Workspace login page? Previously we were able to use the Restrict IP address Instance setting but that doesn't appear to be working now that NGINX is setup as a reverse proxy.

Can you suggest how to do this please?

Regards
JB

Siddharth Rajpoot said...

Hi Dimitri,

I have been scratching my head since 3-4 months. I finally understood that rewrite statement in nginx configuration will stop OCI url to appear when i hit my domain name in browser. However now i am facing session problem. It redirects to my Login page and when i enter credentials and hit login button, it says invalid session and Click here to create a new session. When I click on new session it again shows OCI url. Please help me.

Unknown said...

Hi Dimitri,

Great post, great learning from you.

I used the aapanel to create the lot (nginx stack) and added your bits to it.
Somehow i do not get the /i/ directory loaded correctly, i am using oracle cloud apex and it has /i/21.1.3/

No matter what I add to it I cant get the images loaded.
Do you any suggestions to get around this issue?

I do get the login pages etc. but login doesnt work since the images are not loaded I guess.

Thanks in advance
Rammy