Connecting Cloud n8n with Local Ollama – Complete Tutorial

an abstract image of a sphere with dots and lines

Introduction

This tutorial will guide you through connecting your cloud-hosted n8n instance with Ollama running locally on your PC. We’ll cover multiple methods, from quick testing solutions to more permanent setups.

What is Ollama?

Ollama is a free, open-source application that lets you run large language models (LLMs) locally on your own computer. Think of it as having ChatGPT running on your PC instead of in the cloud.

Prerequisites

  • n8n instance hosted in the cloud (e.g., n8n.cloud, self-hosted VPS)
  • Ollama installed and running on your local PC
  • Basic command line knowledge
  • Administrator access to your PC

Understanding the Problem

Your cloud n8n instance cannot directly access your local Ollama because:

  • Your local PC is behind a router/firewall
  • It doesn’t have a public IP address accessible from the internet
  • Cloud services can only connect to publicly accessible endpoints

Solution: Create a secure tunnel that exposes your local Ollama to the internet.


Method 1: Using ngrok (Best for Testing)

Why ngrok?

  • Quick setup (5 minutes)
  • Free tier available
  • Automatic HTTPS
  • Perfect for development and testing

Step 1: Install ngrok

  1. Visit ngrok.com and create a free account
  2. Download ngrok for your operating system
  3. Extract the executable to a folder (e.g., C:\ngrok)

Step 2: Configure ngrok

  1. Copy your authtoken from the ngrok dashboard
  2. Open Command Prompt or PowerShell and run: ngrok config add-authtoken YOUR_AUTH_TOKEN

Step 3: Start Ollama

  1. Make sure Ollama is running on your PC
  2. By default, Ollama runs on port 11434
  3. Test it locally by opening: http://localhost:11434

Step 4: Create the Tunnel

  1. Open a new terminal window
  2. Run: ngrok http 11434
  3. You’ll see output like: Forwarding https://abc123-456.ngrok.io -> http://localhost:11434
  4. Copy this URL – this is your public Ollama endpoint!

Step 5: Configure n8n

  1. Log into your n8n instance
  2. Create a new workflow
  3. Add an HTTP Request node
  4. Configure it:
    • Method: POST
    • URL: https://abc123-456.ngrok.io/api/generate
    • Authentication: None
    • Body: JSON
    • JSON Body: { "model": "llama2", "prompt": "Why is the sky blue?", "stream": false}
  5. Execute the node to test

Step 6: Parse the Response

  1. Add a Set node after the HTTP Request
  2. Extract the response:
    • Name: ollama_response
    • Value: {{ $json.response }}

Important Notes for ngrok

  • Free tier: Your URL changes every time you restart ngrok
  • Keep terminal open: The tunnel stays active only while ngrok is running
  • Paid tier: Get a permanent URL that doesn’t change

Method 2: Using Cloudflare Tunnel (Best for Permanent Setup)

Why Cloudflare Tunnel?

  • Free forever
  • More reliable than ngrok free tier
  • Can create named tunnels
  • Better for long-term projects

Step 1: Install Cloudflare Tunnel

Windows (using winget):

winget install --id Cloudflare.cloudflared

Windows (manual):

  1. Download from Cloudflare’s website
  2. Extract to a folder like C:\cloudflared
  3. Add to PATH or use full path in commands

Linux/Mac:

# Linux
wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb
sudo dpkg -i cloudflared-linux-amd64.deb

# Mac
brew install cloudflare/cloudflare/cloudflared

Step 2: Authenticate Cloudflare

  1. Run: cloudflared tunnel login
  2. Your browser will open – log in with your Cloudflare account
  3. Select a domain (or create one free at Cloudflare)
  4. Authorize the tunnel

Step 3: Quick Tunnel (Temporary)

For quick testing:

cloudflared tunnel --url http://localhost:11434

This gives you a temporary URL like: https://random-words.trycloudflare.com

Step 4: Named Tunnel (Permanent)

For a permanent setup:

  1. Create a tunnel: cloudflared tunnel create ollama-tunnel Note the tunnel ID that appears
  2. Create a config file (~/.cloudflared/config.yml or C:\Users\YourName\.cloudflared\config.yml): tunnel: TUNNEL_ID_HERE credentials-file: C:\Users\YourName\.cloudflared\TUNNEL_ID.json ingress: - hostname: ollama.yourdomain.com service: http://localhost:11434 - service: http_status:404
  3. Create DNS record: cloudflared tunnel route dns ollama-tunnel ollama.yourdomain.com
  4. Run the tunnel: cloudflared tunnel run ollama-tunnel
  5. Run as a service (optional, so it starts automatically): # Windows (PowerShell as Admin) cloudflared service install # Linux sudo cloudflared service install

Step 5: Use in n8n

Use your tunnel URL: https://ollama.yourdomain.com/api/generate


Method 3: Router Port Forwarding (Advanced)

Why Port Forwarding?

  • No third-party service needed
  • Full control
  • Best performance

When NOT to use this:

  • You don’t have a static IP
  • Your ISP blocks incoming connections
  • You’re not comfortable with network security

Steps:

  1. Find your local IP:
    • Windows: Run ipconfig in CMD
    • Look for “IPv4 Address” (e.g., 192.168.1.100)
  2. Access your router:
    • Usually 192.168.1.1 or 192.168.0.1
    • Log in with admin credentials
  3. Create port forwarding rule:
    • External Port: 11434
    • Internal IP: Your PC’s IP (e.g., 192.168.1.100)
    • Internal Port: 11434
    • Protocol: TCP
  4. Configure Windows Firewall: # Run as Administrator New-NetFirewallRule -DisplayName "Ollama" -Direction Inbound -LocalPort 11434 -Protocol TCP -Action Allow
  5. Set up Dynamic DNS (if no static IP):
    • Use services like DuckDNS, No-IP, or Dynu
    • Install their client on your PC
    • Get a free domain like yourname.duckdns.org
  6. Use in n8n:
    • URL: http://YOUR_PUBLIC_IP:11434/api/generate
    • Or: http://yourname.duckdns.org:11434/api/generate

Building a Complete n8n Workflow

Here’s a practical example workflow that uses your local Ollama:

Workflow: AI-Powered Email Responder

  1. Trigger Node: Manual Trigger or Webhook
  2. HTTP Request Node (Call Ollama):
    • Method: POST
    • URL: YOUR_TUNNEL_URL/api/generate
    • Body: { "model": "llama2", "prompt": "Write a professional email response to: {{ $json.email_content }}", "stream": false}
  3. Code Node (Parse Response): const response = $input.item.json.response; return [{ json: { ai_response: response } }];
  4. Send Email Node or Slack Node:
    • Use {{ $json.ai_response }} as the message

Security Best Practices

1. Add Basic Authentication

Wrap your Ollama endpoint with a reverse proxy (nginx, Caddy) that requires authentication.

2. Use HTTPS Only

  • ngrok: Provides HTTPS automatically
  • Cloudflare: HTTPS by default
  • Port forwarding: Set up Let’s Encrypt

3. IP Whitelisting

If your n8n instance has a static IP, configure your firewall to only accept connections from that IP.

4. Monitor Access

  • Check ngrok/Cloudflare dashboards for unusual traffic
  • Set up alerts for excessive requests

5. Use Environment Variables in n8n

Store your tunnel URL as an environment variable instead of hardcoding it:

  • URL: {{ $env.OLLAMA_URL }}/api/generate

Troubleshooting

“Connection Refused” Error

Check:

  1. Is Ollama running? Test: curl http://localhost:11434
  2. Is your tunnel active? Check the terminal window
  3. Is the URL correct in n8n?

“Timeout” Error

Solutions:

  1. Increase timeout in n8n HTTP Request settings
  2. Use smaller models or shorter prompts
  3. Check your internet connection speed

ngrok URL Changed

Solution:

  • Upgrade to ngrok paid plan for static URLs
  • Or switch to Cloudflare Tunnel (free permanent URLs)

Ollama Not Responding

Check:

  1. Restart Ollama service
  2. Check if port 11434 is already in use: # Windowsnetstat -ano | findstr :11434
  3. Check Ollama logs for errors

Firewall Blocking Connection

Windows:

# Allow Ollama through firewall
New-NetFirewallRule -DisplayName "Ollama" -Direction Inbound -Program "C:\Program Files\Ollama\ollama.exe" -Action Allow

Performance Tips

  1. Use "stream": false in your requests for easier n8n handling
  2. Keep models small for faster responses (e.g., llama2:7b instead of llama2:70b)
  3. Cache responses in n8n if you’re asking the same questions repeatedly
  4. Set appropriate timeouts – AI generation can take 30-60 seconds for longer responses

Cost Comparison

MethodFree TierPaid TierBest For
ngrokURL changes on restart$8/month for static URLTesting
CloudflareFree foreverFree (or paid plans available)Production
Port ForwardFreeFreeAdvanced users

Next Steps

  1. Test the connection with simple prompts
  2. Build a workflow that uses your local LLM
  3. Secure your setup using the security practices above
  4. Scale up by running multiple Ollama models
  5. Automate the tunnel startup using system services

Additional Resources


Conclusion

You now have multiple ways to connect your cloud n8n with local Ollama:

  • Quick testing: Use ngrok
  • Long-term projects: Use Cloudflare Tunnel
  • Maximum control: Use port forwarding

Start with ngrok to test everything works, then move to Cloudflare Tunnel for a permanent setup. Happy automating with local LLMs!

Blockchain Innovations: Practical Use Cases, Crypto Holdings, and Public Sector Impact

As of today, blockchain technology continues to reshape industries and governments alike. From real-world applications in healthcare, supply chain, finance, and public administration to strategic crypto holdings by major corporations, the potential and influence of blockchain are expanding rapidly. This newsletter explores these developments, highlighting how blockchain is transitioning from a foundational technology into a driver of operational transparency, security, and efficiency.

Real-World Blockchain Applications Across Industries

Blockchain’s tangible benefits are evident across numerous sectors. In healthcare, it offers secure, immutable records for patient data, clinical research, and vital certificates, reducing fraud and enhancing trust (DrugPatentWatch). Supply chain management is revolutionized by companies like Walmart, which have cut produce tracking times from days to seconds via shared ledgers and IoT integration (GeeksforGeeks). In finance, blockchain facilitates instant cross-border transactions, asset tokenization, and compliance automation, broadening access and liquidity (Chainlink), (UniAthena).

Clinical trials also gain integrity through data hashing and smart contracts, ensuring transparency and accelerating research (GeeksforGeeks). Digital identity platforms like Civic empower individuals to control their personal data securely, reducing fraud and enabling transparent royalty tracking for creators. Governments worldwide are deploying blockchain for land registration, voting, healthcare, and finance, fostering trust and efficiency—even as challenges remain regarding scalability and energy consumption (ResearchGate).

Major Crypto Holdings: Industry Movers and Strategies

Institutional interest in cryptocurrencies continues to surge, with significant holdings reported by leading firms. BitMine Immersion Technologies recently announced exceeding $6.6 billion in crypto reserves, making it the second-largest Ethereum treasury globally and among the most liquid US stocks, with weekly trading volume averaging $6.4 billion (PR Newswire). Major corporate holders like MicroStrategy, with over 531,600 BTC, continue their long-term accumulation strategies, reflecting a strong belief in bitcoin’s resilience as a store of value (Decrypt).

Broader market data reveal entities like Strategy Inc. holding over 628,946 BTC—valued at approximately $74 billion—while companies such as Tesla and Coinbase maintain substantial positions. Ethereum holdings are also on the rise, with firms aiming to control significant portions of ETH supply, potentially influencing future market dynamics (CCN).

Public Sector Blockchain: Transforming Governance and Public Services

Blockchain is increasingly deployed to enhance transparency and efficiency in public governance. Initiatives include land registries with tamper-proof ledgers, secure healthcare data sharing, and decentralized e-voting platforms (GovTech, Cointelegraph). Digital identities managed via blockchain, exemplified by Estonia’s e-Residency, empower citizens while reducing fraud (Global Government Fintech).

While promising, current challenges such as scalability, energy use, and bureaucratic resistance must be addressed. Continued technological, policy, and infrastructural innovations are essential for blockchain to realize its full potential in public administration, fostering trust, engagement, and efficiency.

As blockchain’s impact deepens, organizations like the Government Blockchain Association will play vital roles in guiding this transformation.

Navigating AI Challenges, Home Business Growth, and Small Business Funding

Welcome to today’s edition of our business insights newsletter, dated 22 August 2025. We explore three vital themes: overcoming hurdles in AI adoption for small and medium enterprises, strategies for turning your homemade passion into profit, and essential guidance on securing small business loans. These topics reflect evolving trends and practical approaches to help entrepreneurs and organizations thrive in competitive markets.

Top Challenges in AI Adoption and How to Address Them

As AI technologies become instrumental in business innovation, organizations face several hurdles hindering successful integration. Key challenges include data quality issues, skills gaps, legacy infrastructure, resistance to change, and ethical considerations. Addressing these requires targeted strategies such as establishing data governance frameworks to mitigate quality concerns (Source), investing in staff training or low-code platforms to bridge skills shortages (Source), and modernizing IT infrastructure via cloud solutions (Source). Cultivating a supportive culture and ensuring ethical AI practices through transparent governance further paves the way for sustainable AI deployment.

Homemade Business Growth: Turning Passion into Profit

Launching a homemade business offers an accessible pathway to entrepreneurship. With startup costs as low as $100 (Source), aspiring entrepreneurs can establish ventures in gourmet foods, craft goods, or natural products. Success hinges on building a loyal customer base via quality, authentic engagement, and effective social media marketing. Specializing in niche markets—like gluten-free baked goods or handmade soaps—can foster brand loyalty and differentiate your offerings. For long-term growth, formalize your business with branding and legal protections to manage risks and scale effectively.

Small Business Loans: Unlocking Growth Opportunities

Access to capital is central to scaling operations, purchasing equipment, or managing cash flow. Types of small business loans include SBA loans, traditional bank loans, online and alternative loans, microloans, and specialized financing options like equipment loans and invoice factoring. Qualification often depends on credit scores, business financial health, and collateral. Preparing a thorough business plan and understanding your financial standing improves approval prospects. Resources such as NerdWallet offer comprehensive comparisons of lenders, guiding entrepreneurs to the best financing solutions for their needs.

Sources

In conclusion, by understanding and proactively addressing these areas—whether integrating AI, launching a homemade venture, or securing funding—businesses can enhance their operational resilience and competitive edge. Embracing modern solutions and strategic planning will be key to turning challenges into opportunities for growth.