[EP.1] เข้าถึง n8n ได้ทุกที่ง่ายๆ ด้วย Cloudflare Tunnel | Step by Step Tutorial ภาษาไทย

3 min read 5 days ago
Published on Aug 31, 2025 This response is partially generated with the help of AI. It may contain inaccuracies.

Table of Contents

Introduction

In this tutorial, we will learn how to access n8n from anywhere in the world using Cloudflare Tunnel. This step-by-step guide is designed for those who have already set up n8n with Docker, as discussed in Episode 0. By the end of this tutorial, you will have n8n running online securely and ready for workflow automation.

Step 1: Setting Up Cloudflare Account

  1. Create a Cloudflare Account

    • Visit Cloudflare and sign up for a free account.
    • Verify your email and log into your new Cloudflare account.
  2. Add a Domain

    • If you don’t have a domain, you can register one. A suggested starting place is this domain registrar.
    • Follow the prompts to add a domain to your Cloudflare account.
  3. Configure DNS Settings

    • After adding the domain, access the DNS settings in your Cloudflare dashboard.
    • Add a new DNS record for your n8n instance.
      • Type: A
      • Name: n8n (or any subdomain you prefer)
      • Value: Your server’s IP address.
      • TTL: Auto.

Step 2: Install Cloudflare Tunnel

  1. Install Cloudflare Tunnel

    • Open your terminal.
    • Run the following command to install the Cloudflare Tunnel:
      curl -sSL https://raw.githubusercontent.com/cloudflare/cloudflared/main/install.sh | sudo bash
      
  2. Authenticate Cloudflare Tunnel

    • Run the command to authenticate:
      cloudflared tunnel login
      
    • Follow the prompts to complete the authentication process.

Step 3: Create a Tunnel for n8n

  1. Create the Tunnel

    • Execute the following command to create a new tunnel:
      cloudflared tunnel create n8n-tunnel
      
    • Note the tunnel ID that is generated.
  2. Configure Tunnel Route

    • Create a configuration file by running:
      nano ~/.cloudflared/config.yml
      
    • Add the following configuration:
      tunnel: YOUR_TUNNEL_ID
      credentials-file: /path/to/your/credentials-file.json
      ingress:
        - hostname: n8n.YOUR_DOMAIN
          service: http://localhost:5678
        - service: http_status:404
      
    • Replace YOUR_TUNNEL_ID and YOUR_DOMAIN with your actual tunnel ID and domain.

Step 4: Start the Tunnel

  1. Run the Tunnel
    • Run the following command to start the tunnel:
      cloudflared tunnel run n8n-tunnel
      
    • This command will keep the tunnel active, allowing you to access n8n remotely.

Tips and Common Pitfalls

  • Firewall Settings: Ensure your firewall allows traffic on the port used by n8n (default is 5678).
  • Domain Propagation: It may take some time for your DNS settings to propagate. Be patient if you cannot access n8n immediately.
  • Secure Your Instance: Consider implementing security measures like basic authentication within n8n to protect your workflows.

Conclusion

By following these steps, you have successfully set up Cloudflare Tunnel for your n8n instance, enabling remote access. This setup not only makes your workflows accessible from anywhere but also enhances security. As a next step, explore creating automated workflows in n8n to streamline your tasks further.