{"id":219,"date":"2026-02-18T10:30:45","date_gmt":"2026-02-18T15:30:45","guid":{"rendered":"https:\/\/webestech.com\/farthinkai\/?p=219"},"modified":"2026-02-22T10:56:58","modified_gmt":"2026-02-22T15:56:58","slug":"self-host-n8n-on-oracle-cloud-free-tier","status":"publish","type":"post","link":"https:\/\/webestech.com\/farthinkai\/self-host-n8n-on-oracle-cloud-free-tier\/","title":{"rendered":"Self-Host n8n on Oracle Cloud Free Tier"},"content":{"rendered":"\n<p>The following commands are used in the YouTube tutorial (<a href=\"https:\/\/www.youtube.com\/watch?v=GQbEj455Cqk\">https:\/\/www.youtube.com\/watch?v=GQbEj455Cqk<\/a>). You can copy and paste them in your terminal.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"How to Self-Host n8n for FREE Forever! (Oracle Cloud + Free Domain) 2026\" width=\"1290\" height=\"726\" src=\"https:\/\/www.youtube.com\/embed\/GQbEj455Cqk?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code># SSH into your instance\nchmod 400 \/path\/to\/your\/my_oracle_key.key # Set correct permissions for private key\nssh -i \/path\/to\/your\/my_oracle_key.key ubuntu@&lt;your_instance_public_ip&gt;\n\n# Update and upgrade System Packages\nsudo apt update -y\nsudo apt upgrade -y\n\n# Install Nginx\nsudo apt install nginx -y\nsudo systemctl start nginx\nsudo systemctl enable nginx\n\n# Check status\nsystemctl status nginx\n\n# Reset iptables policies\nsudo iptables -P INPUT ACCEPT\nsudo iptables -P OUTPUT ACCEPT\nsudo iptables -P FORWARD ACCEPT\nsudo iptables -F\nsudo apt install iptables-persistent -y\nsudo netfilter-persistent save\n\n# Configure Ubuntu firewall (UFW)\nsudo ufw allow 22\/tcp # Allow SSH\nsudo ufw allow 80\/tcp # Allow HTTP\nsudo ufw allow 443\/tcp # Allow HTTPS\nsudo ufw enable\nsudo ufw status verbose # Verify rules are active\n\n# Install Docker and Docker Compose plugin\nsudo apt install ca-certificates curl gnupg lsb-release -y\nsudo install -m 0755 -d \/etc\/apt\/keyrings\ncurl -fsSL https:\/\/download.docker.com\/linux\/ubuntu\/gpg | sudo gpg --dearmor -o \/etc\/apt\/keyrings\/docker.gpg\necho \\\n  \"deb &#91;arch=$(dpkg --print-architecture) signed-by=\/etc\/apt\/keyrings\/docker.gpg] https:\/\/download.docker.com\/linux\/ubuntu \\\n  $(lsb_release -cs) stable\" | sudo tee \/etc\/apt\/sources.list.d\/docker.list &gt; \/dev\/null\nsudo apt update -y\nsudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y\nsudo systemctl start docker\nsudo systemctl enable docker\n\n# Add user (ubuntu) to the docker group\nsudo usermod -aG docker ubuntu\nnewgrp docker # Apply group changes immediately for current session\n\n# Create Nginx web root and test page\nsudo mkdir -p \/var\/www\/html\necho \"Hello from Nginx! Testing HTTP Connectivity.\" | sudo tee \/var\/www\/html\/index.html\nsudo chown -R www-data:www-data \/var\/www\/html\nsudo chmod -R 755 \/var\/www\/html\n\n# Create a new Nginx configuration file\nsudo nano \/etc\/nginx\/conf.d\/n8n.conf\n\n# Paste the following content in the file, save and exit\nserver {\n    listen 443;\n    listen &#91;::]:443;\n    server_name n8n.yourdomain.com; # Your free domain\n\n    location \/.well-known\/acme-challenge\/ {\n        root \/var\/www\/html; # Used by Certbot for verification\n        allow all;\n    }\n\n    location \/ {\n        root \/var\/www\/html; # Temporarily serve static HTML\n        index index.html index.htm;\n        try_files $uri $uri\/ =404;\n    }\n}\n\n# Test Nginx configuration and reload\nsudo nginx -t\nsudo systemctl reload nginx\n\n# Install Certbot and Nginx plugin\nsudo apt install certbot python3-certbot-nginx -y\n\n# Run Certbot\nsudo certbot --nginx -d n8n.yourdomain.com # Your free domain\n\n# Test Certbot automatic renewal\nsudo certbot renew --dry-run\n\n# Create a directory for n8n\nmkdir ~\/n8n\ncd ~\/n8n\n\n# Generate a unique N8N_ENCRYPTION_KEY, and copy the generated key for later use\nhead \/dev\/urandom | tr -dc A-Za-z0-9_ | head -c 32 ; echo ''\n\n# Create docker-compose.yml\nnano docker-compose.yml\n\n# Paste the following content in the file, save and exit\nservices:\n  postgres:\n    image: postgres:15\n    restart: always\n    environment:\n      POSTGRES_DB: n8n\n      POSTGRES_USER: n8nuser\n      POSTGRES_PASSWORD: your_strong_database_password # CHANGE THIS!\n    volumes:\n      - .\/pg_data:\/var\/lib\/postgresql\/data\n    networks:\n      - n8n_backend\n    healthcheck: # Ensures n8n waits for DB to be ready\n      test: &#91;'CMD-SHELL', 'pg_isready -U n8nuser -d n8n']\n      interval: 5s\n      timeout: 5s\n      retries: 5\n\n  n8n:\n    image: n8nio\/n8n\n    restart: always\n    environment:\n      DB_TYPE: postgresdb\n      DB_POSTGRESDB_HOST: postgres\n      DB_POSTGRESDB_PORT: 5432\n      DB_POSTGRESDB_DATABASE: n8n\n      DB_POSTGRESDB_USER: n8nuser\n      DB_POSTGRESDB_PASSWORD: your_strong_database_password # MUST MATCH ABOVE!\n      N8N_HOST: n8n.yourdomain.com # CHANGE THIS to your free domain\n      WEBHOOK_URL: https:\/\/n8n.yourdomain.com\/ # CHANGE THIS to your free domain\n      N8N_PROTOCOL: https\n      GENERIC_TIMEZONE: America\/Toronto # Adjust to your timezone\n      N8N_ENCRYPTION_KEY: your_generated_32_char_key # PASTE THE GENERATED KEY HERE\n    ports:\n      - '127.0.0.1:5678:5678' # Only expose to localhost for Nginx proxy\n    volumes:\n      - .\/n8n_data:\/home\/node\/.n8n\n    networks:\n      - n8n_backend\n    depends_on:\n      postgres:\n        condition: service_healthy # Wait for DB to be healthy\n\nnetworks:\n  n8n_backend:\n    driver: bridge\n\n# Set permissions for n8n data volume\nmkdir n8n_data &amp;&amp; sudo chown -R 1000:1000 n8n_data\n\n# Start n8n and the Database\ndocker compose up -d\n\n# Verify both n8n and postgres Docker containers (showing Up status)\ndocker ps\n\n# Edit the Nginx configuration file again\nsudo nano \/etc\/nginx\/conf.d\/n8n.conf\n\n# In the file, replace the location block with the following content, save and exit\n    location \/ {\n        proxy_pass http:\/\/localhost:5678; # n8n Docker container is accessible on localhost:5678\n        proxy_set_header Host $host;\n        proxy_set_header X-Real-IP $remote_addr;\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n        proxy_set_header X-Forwarded-Proto $scheme;\n        proxy_http_version 1.1;\n        proxy_set_header Upgrade $http_upgrade;\n        proxy_set_header Connection \"upgrade\";\n        proxy_buffering off; # Important for long-running workflows\n    }\n\n# Test Nginx configuration and reload\nsudo nginx -t\nsudo systemctl reload nginx\n\n# Open your browser and enter the URL https:\/\/n8n.yourdomain.com (replace with your free domain). You should now see the n8n setup webpage. Enjoy building n8n automation workflows!<\/code><\/pre>\n\n\n\n<p>Reference:&nbsp;<a href=\"https:\/\/itnext.io\/mastering-automation-a-step-by-step-guide-to-deploying-n8n-on-oracle-cloud-free-tier-3e9c84cdba9e\">reference<\/a><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The following commands are used in the YouTube tutorial (https:\/\/www.youtube.com\/watch?v=GQbEj455Cqk). You can copy and paste them in your terminal. Reference:&nbsp;reference<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[56],"tags":[],"class_list":["post-219","post","type-post","status-publish","format-standard","hentry","category-ai-assistant"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/webestech.com\/farthinkai\/wp-json\/wp\/v2\/posts\/219","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webestech.com\/farthinkai\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webestech.com\/farthinkai\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webestech.com\/farthinkai\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/webestech.com\/farthinkai\/wp-json\/wp\/v2\/comments?post=219"}],"version-history":[{"count":2,"href":"https:\/\/webestech.com\/farthinkai\/wp-json\/wp\/v2\/posts\/219\/revisions"}],"predecessor-version":[{"id":228,"href":"https:\/\/webestech.com\/farthinkai\/wp-json\/wp\/v2\/posts\/219\/revisions\/228"}],"wp:attachment":[{"href":"https:\/\/webestech.com\/farthinkai\/wp-json\/wp\/v2\/media?parent=219"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webestech.com\/farthinkai\/wp-json\/wp\/v2\/categories?post=219"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webestech.com\/farthinkai\/wp-json\/wp\/v2\/tags?post=219"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}