Oracle VM + Cloudflare + Nginx HTTPS Setup
A short checklist I use to bring up a public site on an Oracle VM, fronted by Cloudflare, with HTTPS via Let’s Encrypt.
1) Oracle dashboard networking
Path: /overview/instances/instance
- In Default Route Table / Route Rules, make sure you have
0.0.0.0/0 -> Internet Gateway. - In Networking / subnet / security / security list, allow inbound
0.0.0.0/0for ports80and443.
2) Cloudflare
- Add your A record in DNS.
- Set SSL/TLS mode to Full (strict).
3) VM setup
- Install Let’s Encrypt with Certbot.
- Configure Nginx with HTTP to HTTPS redirect and TLS site config.
server {
listen 80;
server_name foobar.baz www.foobar.baz;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name foobarbaz.win www.foobar.baz;
root /var/www/example;
index index.html;
ssl_certificate /etc/letsencrypt/live/foobar.baz/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/foobar.baz/privkey.pem;
location / {
try_files $uri $uri/ =404;
}
}
4) VM firewall
sudo iptables -I INPUT -p tcp --dport 80 -m state --state NEW -j ACCEPT
sudo iptables -I INPUT -p tcp --dport 443 -m state --state NEW -j ACCEPT