Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


How to Host a Website in Oracle Cloud Free Tier
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

How to Host a Website in Oracle Cloud Free Tier

yoursunnyyoursunny Member, IPv6 Advocate

This post is originally published on yoursunny.com blog https://yoursunny.com/t/2020/OracleCloud-website/

Oracle Cloud is a cloud computing service offered by Oracle Corporation.
Oracle Cloud has a generous free tier that offers two "always free" virtual machine (VM) instances with the following specification:

  • KVM virtualization
  • 1/8 CPU cores (AMD EPYC 7551)
  • 1GB memory
  • 45GB disk storage
  • 1 IPv4 address, no IPv6
  • 48Mbps Internet bandwidth

I signed up for Oracle Cloud, so that I can have some more free computing resources to play with.
The sign-up procedure requires a credit card for identity confirmation purpose, but the credit card will not be charged.
During sign-up, there's a choice of home region, which determines the location of VM instances; once selected, it cannot be changed in the future.

A common use case for a virtual machine is to host a website.
Due to the firewalls, hosting a website on Oracle Cloud needs a few more steps.
Here's exactly how to deploy a website in a Oracle Cloud Free Tier VM instance.

Create a VM Instance

Each Oracle Cloud account is eligible for two Always Free VM instances.
To create a VM, sign in to the Oracle Cloud console, in "Quick Actions" section click Create a VM instance.

Oracle Cloud console - Quick Actions

This takes us to the "Create Compute Instance" page.

In "Configure placement and hardware" section, change the "image" to Canonical Ubuntu 20.04.
Do not select the "Canonical Ubuntu 20.04 Minimal" option.

Create Compute Instance - Configure placement and hardware

In "Configure network" section, select Create new virtual cloud network, and keep other options at their default values.

Create Compute Instance - Configure networking

In "Add SSH keys" section, select Paste public keys, and paste your SSH public key in the text box below.
If you do not have a SSH public key, follow this guide to generate one.

Finally, click the Create button to create the compute VM instance.
Within a few seconds, you should see the "Instance Details" page.

Instance Details

You can now SSH into the VM instance using the public IP address and username displayed in the "Instance Access" section.
This is also a good time to add a DNS record toward the public IP address, so that we can activate HTTPS later.

DNS record

Configure Ingress Rules

Oracle Cloud has a strict firewall that, by default, only allows SSH access.
In order to host a website, it is necessary to configure the firewall so that it allows HTTP traffic.

To access the firewall configuration page, click the "subnet" name in "Primary VNIC" section of "Instance Details" page.
Then, on "Subnet Details" page, click "Default Security List for …" in "Security Lists" section.
Click Add Ingress Rules button, and enter these two rules:

  • Allow HTTP/1.1 and HTTP/2

    • stateless: disabled
    • source CIDR: 0.0.0.0/0
    • IP protocol: TCP
    • destination port range: 80,443
  • Allow HTTP/3

    • stateless: disabled
    • source CIDR: 0.0.0.0/0
    • IP protocol: UDP
    • destination port range: 443

After that, you should see the following ingress rules in the table:

Virtual Cloud Networks - Ingress Rules

Install HTTP Server

With the firewall rules in place, we are ready to install an HTTP server.
In this guide, I'm installing Caddy HTTP server along with PHP-FPM.
They can be installed from Caddy package repository and ondrej/php PPA respectively.

Section omitted because it's being blocked by the excessive Cloudflare security settings of this forum, please see original article on yoursunny.com blog https://yoursunny.com/t/2020/OracleCloud-website/

Before we can start the HTTP server, there's one more firewall to configure: the local iptables.
Oracle Cloud not only has an external firewall at subnet level, but also blocks traffic in iptables INPUT chain.
We can setup a systemd service to insert iptables rules before Caddy starts:

Section omitted because it's being blocked by the excessive Cloudflare security settings of this forum, please see original article on yoursunny.com blog https://yoursunny.com/t/2020/OracleCloud-website/

Upload your website content, and make sure the www-data group can access them.
In this example, I'll create two simple files:

Section omitted because it's being blocked by the excessive Cloudflare security settings of this forum, please see original article on yoursunny.com blog https://yoursunny.com/t/2020/OracleCloud-website/

Edit the Caddyfile (/etc/caddy/Caddyfile), paste the following:
(change the domain name and root directory as appropriate)

Section omitted because it's being blocked by the excessive Cloudflare security settings of this forum, please see original article on yoursunny.com blog https://yoursunny.com/t/2020/OracleCloud-website/

Finally, restart the webserver for the settings to take effect:

Section omitted because it's being blocked by the excessive Cloudflare security settings of this forum, please see original article on yoursunny.com blog https://yoursunny.com/t/2020/OracleCloud-website/

Test the Website

To confirm everything is working, we can visit the index page https://demo.example.com/ and the PHP script https://demo.example.com/phpinfo.php in the browser.

Then, we execute the curl command line tool (on a different machine) to confirm the HTTP-to-HTTPS redirect is working properly, and the website works over HTTP/1.0, HTTP/1.1, HTTP/2, and HTTP/3.

Section omitted because it's being blocked by the excessive Cloudflare security settings of this forum, please see original article on yoursunny.com blog https://yoursunny.com/t/2020/OracleCloud-website/

Finally, we use SSL Server Test to verify that TLS certificates and crypto are configured securely, and use Security Headers to check that HTTP Strict Transport Security is setup correctly.

Conclusion

This article explains how to deploy a website in a VM instance on Oracle Cloud Free Tier.
It involves the following steps:

  1. Create an always free compute VM instance.
  2. Add ingress rules in Virtual Cloud Network subnet.
  3. Install Caddy HTTP server and PHP.
  4. Configure local iptables firewall.
  5. Test the website installation.
It's hard to write a tutorial without code snippets!
  1. Is the Cloudflare settings of this forum too strict?44 votes
    1. Definitely
      45.45%
    2. Yes
      22.73%
    3. Sure
      11.36%
    4. Not really
      20.45%
«1

Comments

  • I still prefer Debian because the Ubuntu image isn't snappy enough for me, even it's "minimal".

    I just figured out how to completely reinstall a free Oracle VM from Ubuntu to Debian 10 Buster with GRUB-booted Debian Network Installer. Here's the script: https://github.com/bohanyang/debi

    Although the feature is done, it's still not properly documented yet.

    Thanked by 1chihcherng
  • @yoursunny always great content from you!

    Thanks

  • +Total 100GB block storage including 2 instances & minimum boot volume for the free tier instance is 46.6GB. One single instance can have 100GB of free storage. In this case, 2nd free instance can't be created as there will no free tier storage left.

  • rm_rm_ IPv6 Advocate, Veteran
    edited December 2020

    Keep in mind the CPU is indeed quite limited. As I recently tested, an AMD Sempron CPU from 2004 is faster (147) than this VPS (120 MB/s). However should be fine for hosting static websites or with a light CMS such as DokuWiki.

    The main strength of this offer is that you get 10 TB bandwidth for free, in locations such as India, Japan, South Korea and iirc also Brazil. And the CPU should be more than enough to run a 48 Mbit VPN, especially if using WireGuard.

  • Thank you so much!

  • Oh, this is nice! Thank you for sharing this.

    Btw, unless I am missing something, isn't the network speed 480 Mbps?

    @Hakim said:
    +Total 100GB block storage including 2 instances & minimum boot volume for the free tier instance is 46.6GB. One single instance can have 100GB of free storage. In this case, 2nd free instance can't be created as there will no free tier storage left.

    This indeed seems to confirm what Hakim said.

    @rm_ said: The main strength of this offer is that you get 10 TB bandwidth for free, in locations such as India, Japan, South Korea and iirc also Brazil. And the CPU should be more than enough to run a 48 Mbit VPN, especially if using WireGuard.

    Are the 10 TB mentioned somewhere explicitly, or was this just an estimate?

    Also, the You must create the Always Free Compute instances in your home region. sentence here might limit the usefulness of what you suggested as a possible use for the free tier.

  • rm_rm_ IPv6 Advocate, Veteran

    Are the 10 TB mentioned somewhere explicitly, or was this just an estimate?

    Mentioned here: https://www.oracle.com/cloud/free/#always-free

    "Outbound Data Transfer: 10 TB per month."

    I am not sure what will happen if you exceed that.

    Also, the You must create the Always Free Compute instances in your home region

    Yes, so decide ahead which one of the locations you want, and choose that as your home region. I saw someone mention registering multiple accounts, but that feels like a dishonest thing to do.

  • @rm_ said: Mentioned here: https://www.oracle.com/cloud/free/#always-free

    "Outbound Data Transfer: 10 TB per month."

    Ah, it's there under "Additional services", heh. Thank you :)

    @rm_ said: Yes, so decide ahead which one of the locations you want, and choose that as your home region. I saw someone mention registering multiple accounts, but that feels like a dishonest thing to do.

    Oh, if you can choose your home region, then it makes sense; sorry. Multiple accounts would obviously be against the ToS... but to each his own, I suppose.

  • daffydaffy Member
    edited December 2020

    Hint hint, if you use Oracle Linux you actually get the full 480Mbit (or whatever) they promise, even though I get why that's a hard sell for some...

  • @daffy said:
    Hint hint, if you use Oracle Linux you actually get the full 480Mbit (or whatever) they promise, even though I get why that's a hard sell for some...

    What the hell...
    Oracle is sneaky...
    Gonna try it now
    Oracle linux is basically centos yes?

  • rm_rm_ IPv6 Advocate, Veteran

    if you use Oracle Linux you actually get the full 480Mbit (or whatever) they promise

    Sounds very dubious, where they "promise" that?

  • I don't think that's true... On my speedtests (Oracle Linux or Ubuntu) I haven't been able to hit about 100 Mbps. What region are you in?

  • I'm in Frankfurt. Confirmed in multiple instances, Ubuntu and CentOS gives 50 Mbit, while Oracle gives the full beans... I mean, I get why, but shady AF 🤔

    Thanked by 1kkrajk
  • @rm_ said:

    if you use Oracle Linux you actually get the full 480Mbit (or whatever) they promise

    Sounds very dubious, where they "promise" that?

    On the free tier info page they state 0,48Gbit.

    Thanked by 1coreflux
  • yoursunnyyoursunny Member, IPv6 Advocate

    @rm_ said:
    Keep in mind the CPU is indeed quite limited.

    Frankfurt

    Geekbench 5 Benchmark Test:
    ---------------------------------
    Test            | Value                         
                    |                               
    Single Core     | 279                           
    Multi Core      | 325                           
    Full Test       | https://browser.geekbench.com/v5/cpu/2203446
    

    Tokyo

    Geekbench 5 test failed. Run manually to determine cause.
    

    The main strength of this offer is that you get 10 TB bandwidth for free, in locations such as India, Japan, South Korea and iirc also Brazil. And the CPU should be more than enough to run a 48 Mbit VPN, especially if using WireGuard.

    I have Tokyo location. The connection is only good within Japan and toward USA. Routing from China and Europe would go through USA.


    @rhinoduck said:
    Btw, unless I am missing something, isn't the network speed 480 Mbps?

    The port is 480Mbps, but you can only get to this speed within the data center.
    Internet bandwidth is 48Mbps.

    YABS in Tokyo

    iperf3 Network Speed Tests (IPv4):
    ---------------------------------
    Provider        | Location (Link)           | Send Speed      | Recv Speed     
                    |                           |                 |                
    Clouvider       | London, UK (10G)          | 44.8 Mbits/sec  | 44.9 Mbits/sec 
    Online.net      | Paris, FR (10G)           | 44.6 Mbits/sec  | 45.4 Mbits/sec 
    WorldStream     | The Netherlands (10G)     | 43.8 Mbits/sec  | 44.6 Mbits/sec 
    Wifx            | Zurich, CH (10G)          | 42.4 Mbits/sec  | 40.8 Mbits/sec 
    Biznet          | Jakarta, Indonesia (1G)   | 48.2 Mbits/sec  | 40.7 Mbits/sec 
    Clouvider       | NYC, NY, US (10G)         | 46.6 Mbits/sec  | 45.8 Mbits/sec 
    Velocity Online | Tallahassee, FL, US (10G) | 45.1 Mbits/sec  | 45.7 Mbits/sec 
    Clouvider       | Los Angeles, CA, US (10G) | busy            | busy           
    Iveloz Telecom  | Sao Paulo, BR (2G)        | busy            | busy    
    

    48Mbps is enough for small websites.
    If you have a large website, you can afford a larger instance with SR-IOV ports.

    Thanked by 1coreflux
  • rm_rm_ IPv6 Advocate, Veteran

    On the free tier info page they state 0,48Gbit.

    Where does anything say that you must install Oracle Linux to get this?

    And yes you do get the 480 Mbit speed within the DC between your VPSes -- but that's with any distro.

  • Nice tutorial as always even though I would probably still stay away from Oracle. Also any traffic spike to your blog thanks to Cloudflare ?

  • @rm_ said:

    On the free tier info page they state 0,48Gbit.

    Where does anything say that you must install Oracle Linux to get this?

    And yes you do get the 480 Mbit speed within the DC between your VPSes -- but that's with any distro.

    No, did I say the mention that somewhere? I discovered this accidentally, doing tabs on an instance with Oracle Linux. Reproducible in case you want to try..

  • DoragonDoragon Member
    edited December 2020

    edit: nevermind I'm an idiot it's open lol

  • Can anybody confirm oracle linux can hit 480Mbps in Mumbai or your home region? I don't want to lose my precious IP address.

  • @Hakim said:
    +Total 100GB block storage including 2 instances & minimum boot volume for the free tier instance is 46.6GB. One single instance can have 100GB of free storage. In this case, 2nd free instance can't be created as there will no free tier storage

    Hi,how you create 100gb blockvolume for free?
    By default only 50 gb is free per instance?

  • @suricloud said: By default only 50 gb is free per instance?

    No. It depends on the OS image. Example: Windows image minimum(default) size probably 250GB. For Linux, it's 46.6GB as far I remember.

    @suricloud said: Hi,how you create 100gb blockvolume for free?

    You can provide the boot volume size manually. The size has to be equal or greater than the default image size. For Linux, it can be 47 to 100GB & it will fall under the always free tier quota. You can also expand the boot volume size anytime.

    You can have a total of 100GB block volume. It can be 46.6GB boot2 instance+6GB block volume, 50GB(boot)2 instance or 1 100GB instance.

    Currently, I am using two instances with 47GB & 53GB.

  • @Hakim said:

    @suricloud said: By default only 50 gb is free per instance?

    No. It depends on the OS image. Example: Windows image minimum(default) size probably 250GB. For Linux, it's 46.6GB as far I remember.

    @suricloud said: Hi,how you create 100gb blockvolume for free?

    You can provide the boot volume size manually. The size has to be equal or greater than the default image size. For Linux, it can be 47 to 100GB & it will fall under the always free tier quota. You can also expand the boot volume size anytime.

    You can have a total of 100GB block volume. It can be 46.6GB boot2 instance+6GB block volume, 50GB(boot)2 instance or 1 100GB instance.

    Currently, I am using two instances with 47GB & 53GB.

    and both are in free tier?

  • raindog308raindog308 Administrator, Veteran

    @forces said: Oracle linux is basically centos yes?

    Basically CentOS "Classic".

  • Daniel15Daniel15 Veteran
    edited December 2020

    @Chocoweb said:
    I still prefer Debian because the Ubuntu image isn't snappy enough for me, even it's "minimal".

    I just figured out how to completely reinstall a free Oracle VM from Ubuntu to Debian 10 Buster with GRUB-booted Debian Network Installer. Here's the script: https://github.com/bohanyang/debi

    Although the feature is done, it's still not properly documented yet.

    Wow, you can just install regular Debian and it works fine? I asked their support about it a while ago and they said that Debian wouldn't run for some reason, and I'd have to choose Ubuntu instead.

    In that case, installing ipxe (apt install ipxe) then rebooting into it and using netboot.xyz may work too.

  • That's odd. I don't remember making any IPTable changes on any of my services. It has been about a year since I've actively managed these (beyond security updates and app updates) but as long as I had my security lists it was fine to go.

  • @Daniel15 said:

    @Chocoweb said:
    I still prefer Debian because the Ubuntu image isn't snappy enough for me, even it's "minimal".

    I just figured out how to completely reinstall a free Oracle VM from Ubuntu to Debian 10 Buster with GRUB-booted Debian Network Installer. Here's the script: https://github.com/bohanyang/debi

    Although the feature is done, it's still not properly documented yet.

    Wow, you can just install regular Debian and it works fine? I asked their support about it a while ago and they said that Debian wouldn't run for some reason, and I'd have to choose Ubuntu instead.

    In that case, installing ipxe (apt install ipxe) then rebooting into it and using netboot.xyz may work too.

    Oracle support said Debian 10 won't run for some reason? (Expressing all the nofucksgiven, too)

    Sounds about right for the Oracle C team.

  • @TimboJones said: Oracle support said Debian 10 won't run for some reason?

    Yeah, they straight up told me something like "Debian doesn't work on Oracle Cloud, you'll need to use Ubuntu instead". Unfortunately I don't have the chat conversation saved anywhere.

  • it's free, why not!

  • @ravenchad said: and both are in free tier?

    Yeah

Sign In or Register to comment.