Skip to main content

Changing the domain for n8n on VPS

How to change default domain for n8n VPS?

Updated yesterday

If you want to use your own domain (or subdomain) for accessing n8n instead of the default srvXXXXX.hstgr.cloud address, you can update the configuration by following these steps:

  1. First, please make sure that the n8n subdomain of your desired domain is correctly pointed to your VPS IP address using an A record in your DNS settings.

  2. Access your VPS through a browser terminal:

    Browser terminal
  3. Edit the environment configuration file by running:

    nano .env
  4. On the second line of the file, locate the domain entry (typically something like srvXXXXX.hstgr.cloud) and replace it with your own domain that points to your VPS.

    n8n .env file
  5. Save the file by pressing Ctrl+X, then Y, and Enter.

  6. Restart the n8n service to apply the changes:

    docker compose down
    docker compose up -d

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

Did this answer your question?