Changing the domain for n8n on VPS at Hostinger

Change the n8n domain on your Hostinger VPS from the default srvXXXXX.hstgr.cloud address to your own domain or subdomain by updating Traefik settings.

Updated 2 weeks ago

Change the default domain for n8n on VPS at Hostinger to use your own domain or subdomain instead of the default srvXXXXX.hstgr.cloud address.

Before you start

Update your n8n domain configuration

You can update the configuration by following these steps:

  1. Access your VPS through the Hostinger VPS Web Console:

  2. Navigate to the container directory (replace [container-name] with your actual container’s name):

    cd /docker/[container-name]
  3. Edit the environment configuration file by running:

    nano .env
  4. Locate the TRAEFIK_HOST value and replace it with your own domain or subdomain that points to your VPS, for example sub.domain.tld.
  5. Save the file by pressing Ctrl+X, then Y, and Enter.
  6. Open the docker-compose.yml file by running nano docker-compose.yml and make two changes:
    • Change 1 — Fix the WEBHOOK_URL:
      # Before
      - WEBHOOK_URL=https://${COMPOSE_PROJECT_NAME}.${TRAEFIK_HOST}/
      
      # After
      - WEBHOOK_URL=https://${TRAEFIK_HOST}/
    • Change 2 — Fix the Traefik router rule:
      # Before
      - traefik.http.routers.${COMPOSE_PROJECT_NAME}.rule=Host(`${COMPOSE_PROJECT_NAME}.${TRAEFIK_HOST}`)
      
      # After
      - traefik.http.routers.${COMPOSE_PROJECT_NAME}.rule=Host(`${TRAEFIK_HOST}`)

  7. Restart the n8n service to apply the changes:
    docker compose down
    docker compose up -d

Once restarted, you can access n8n via your custom domain. Make sure DNS propagation is complete before testing the new address.