Host n8n locally using nginxproxymanager and duck dns

Hello everyone!

I am trying to locally run n8n using a reverse proxy like Nginx Proxy Manager and a DNS provider like Duck DNS. This is my first time deploying something, so if I make any technical mistakes, please feel free to correct me; I am trying to learn as much as I can.

I am deploying n8n and Nginx Proxy Manager instances using Docker Compose. Here is a sample file with random environment variables:

yaml

Copiar código

version: '3.8'

services:
  n8n:
    image: docker.n8n.io/n8nio/n8n
    ports:
      - "5678:5678"
    volumes:
      - n8n_data:/home/node/.n8n
    environment:
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER=yourusername
      - N8N_BASIC_AUTH_PASSWORD=yourpassword
      - N8N_HOST=n8n.globaldomain.duckdns.org
      - WEBHOOK_TUNNEL_URL=http://n8n.globaldomain.duckdns.org/  # Should I use https?
    networks:
      - n8n_network
    restart: always

  nginxproxymanager:
    image: 'jc21/nginx-proxy-manager:latest'
    container_name: nginxproxymanager
    restart: unless-stopped
    ports:
      - '80:80'
      - '81:81'
      - '443:443'
    volumes:
      - ./nginx/data:/data
      - ./nginx/letsencrypt:/etc/letsencrypt
    networks:
      - n8n_network

volumes:
  n8n_data:

networks:
  n8n_network:
    driver: bridge

Deploying the containers works fine. I have created two proxy hosts in the Nginx Proxy Manager UI: globaldomain.duckdns.org for the Nginx Proxy Manager website and n8n.globaldomain.duckdns.org for the n8n website. Both of them use the same SSL certificate, which you can create on the Nginx Proxy Manager website. The first one listens to port 81 and the second one to port 5678. Both of them use the HTTP method with the SSL force and HTTP/2 options activated.

I have no trouble accessing the Nginx Proxy Manager or n8n websites using these Duck DNS domains. However, I am facing some issues when connecting n8n with other APIs that require the use of webhooks to enable communication between them.

It’s my first time configuring things in the Google Developer Console. I have configured an OAuth consent screen using the domain globaldomain.duckdns.org, enabled the Gmail API, and added some credentials. However, when clicking on the “Sign in with Google” button that appears on each node connection window and signing in with the required account (the same as the one from Google Developer Console), I receive a message of unauthorized access. I think I resolved that by changing the domain of the OAuth consent screen to the one mentioned previously (before that, I had n8n.cloud). Now, what I am seeing is that I cannot access that connection because Google is trying to verify it. Am I on the right path, or is there something I am missing? Are all the environment variables correctly set up for my containers?

My main goal is to host n8n locally and use it for learning purposes, such as connecting with Telegram, Drive, OpenAI, and all that stuff.

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hi @AnderGI

Thanks for posting here and welcome to the community! :cake:

This looks like some old config you got there! Where did you find that? :eyes:

You will need to use WEBHOOK_URL instead of WEBHOOK_TUNNEL_URL and yes, set it to https if you are using https from your nginx proxy manager install.

You can find more information here:

Hi @ria !
Thanks for answering. I am gonna try this now. To be honest I’ve used some help from omni :sweat_smile: so maybe there is the reason for having some of those variables outdated.