How to Host Multiple Websites (incl. n8n) with Docker & Traefik on One Server!
Traefik Application Proxy
Effortlessly expose your microservices to the internet.
PURCHASE SUPPORT

- Open Source
- Ingress Controller + Reverse Proxy + Load balancer
- Services Auto-Discovery
- HTTP/2/3, TCP, UDP, gRPC, Websockets
- Lightweight & Cloud-Native
- Real-time Metrics & Distributed Tracing
- Public Plugins with Rich Catalog
- Ingress-View Dashboard
- Canary Deployments
- Default Ingress in SUSE Rancher K3s
- Default Ingress in Nutanix NKP
New!
- Supports Docker Swarm, Hashicorp Nomad, Azure Service Fabric, K8s Distros, Virtual Machines, & Bare Metal
- Web Application Firewall (WAF)
- OpenTelemetry Metrics, Traces, & Logs
Last updated on July 1, 2025 at 11:17 pm
Hey guys, remember how excited I was when I found this n8n automation tool? (Note: open source alternative to Zapier). I have previously shared how I used n8n to automate and create my infographic in less than 1 minute – check it here! 😁
I like this tool, and that’s why I start to think about how to self-host this n8n website on my VPS hosting! At the same time, I’m excited to self-host other services on my VPS server, such as NocoDB – a no-code database platform and an alternative to AirTable.
But, the problem here: handling lots of websites on a single VPS server is a bit of a hassle, right? Setting up even just one can be confusing with all the technical stuff like server settings and SSL certificates.
Well, good news – with Docker and Traefik, now you can easily host multiple websites on a single VPS server!
In this beginner guide, I’ll show you how these tools allowed me to host multiple websites, such as:
- n8n.yourdomain.com
- nocodb.yourdomain.com
Wait no more! Let’s get started!
How Traefik works as a Reverse Proxy for Hosting Multiple Docker Apps
Before we dive in, let’s quickly grasp the concept of hosting through Docker and Traefik.
Imagine you have many websites, and you want each to have its web address (like my-website.com). The traditional way is to use port numbers, like my-website.com:5678.
However, this can get messy and isn’t user-friendly. It’s like having to tell someone not just the street but also the house number every time you give directions.
That’s why we’re using Traefik reverse proxy in our VPS hosting — it efficiently handles the requests coming to our server and redirects the traffic to the proper application, without explicitly exposing port numbers.

Add SSH public key to your VPS Control Panel (in my case, it’s Hyperhost )
Introduction to the tools for self-hosting
– What is n8n?
n8n is a free and open-source workflow automation tool similar to IFTTT or Zapier. It allows you to integrate different apps and services through predefined triggers and actions.
Compared to Zapier and IFTT, n8n provides more flexibility for advanced integrations, customizable workflows, self-hosting capabilities, and no usage-based pricing. It’s quickly gaining popularity in the automation space.
To create workflows, n8n provides over 300 ready-made nodes for popular apps like Gmail, Twitter, Telegram, etc. You arrange the triggers and actions however you like to automate tasks. For example, you could set up a workflow to post Tweets whenever you get a new email or add data to Airtable when someone fills out a Typeform.
– What is VPS Hosting?
VPS (Virtual Private Server) is a hosting service that uses virtualization technology to provide you with dedicated (private) resources on a server with multiple users. In this article, I’m using Hyperhost Affordable Plan, but you could also check out other popular options like Digital Ocean or Hetzner Cloud.
– What is Cloudflare?
Cloudflare is a widely recognized internet network utilized by individuals to enhance the security and performance of their websites and services. Cloudflare offers a variety of services, including content delivery network (CDN), cloud cybersecurity, DDoS mitigation, and ICANN-accredited domain registration services. Read more here.
– What is Docker?
Docker is a platform that allows developers to containerize and easily ship software. It helps eliminate the overhead of configuring environments to run software by, essentially, shipping the environment along with your code. Read more here.
– What is Putty?
PuTTY is an SSH client application used for establishing secure connections to remote servers. To initiate an SSH connection using PuTTY, you’ll require specific credentials, including the server’s IP address, SSH port, SSH username, and SSH password.
PuTTYGen, short for PuTTY Key Generator, is a key generator tool for creating pairs of public and private SSH keys.
Prerequisites
- Get a domain from Namecheap or GoDaddy
- Set up Cloudflare as your DNS provider
- Choose your VPS server plan
(i) Make sure the hosting is good by checking the reviews
(ii) Check the minimum specs needed for your app. For example, for VPS hosting for n8n, I choose to have 1.5GB RAM, as n8n requires around 320MB to 2GB RAM as outlined here. - Install the Ubuntu on your VPS server
- Install PuTTY on your laptop
- Get a free custom domain email (Note: I used Zoho Mail)
- Familiar with Linux commands, SSH, and Docker
Steps to self-host multiple Docker Apps
Alright, here is the fun part! Let us dive into hosting Docker Apps on your VPS server! In this article, we’ll start hosting n8n via Docker.
If you plan to host another Docker app on the same VPS server later, simply repeat the upcoming step 6 with a slightly different configuration, which we’ll discuss in detail shortly.
1. Setting up Subdomains in DNS
First, create subdomains (like n8n.yourdomain.com) for your n8n app. (Note: replace yourdomain.com with your domain throughout the guide)
If you’ve set up your domain’s DNS provider such as Cloudflare, add an A record for the n8n subdomain, as below:
Type: A
Name: n8n (or the desired subdomain)
IP address: <IP_OF_YOUR_SERVER>
Here’s an example of how to do it on Cloudflare:

Add SSH public key to your VPS Control Panel (in my case, it’s Hyperhost )
Repeat this process for Traefik and NocoDB (optional) to create subdomains for hosting your Docker Apps as websites.
2. Generate and Install SSH Public Key on the Server
Next, install the latest version of PuTTY on your Windows laptop here: https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html.
Once installed, open the “PuTTY Key Generator” app and click the “ Generate ” button to create the SSH key pair.

Add SSH public key to your VPS Control Panel (in my case, it’s Hyperhost )
With your SSH public key ready, head to your VPS Control Panel to add it to your server. The steps might vary depending on your VPS provider.

Add SSH public key to your VPS Control Panel (in my case, it’s Hyperhost )
Add SSH public key to your VPS Control Panel (in my case, it’s Hyperhost)
Go back to your “PuTTY Key Generator” app and click the “ Save private key ” button to save your SSH private key on your laptop.

Add SSH public key to your VPS Control Panel (in my case, it’s Hyperhost )
Then, your SSH private key will be saved in.ppk format.

Add SSH public key to your VPS Control Panel (in my case, it’s Hyperhost )
3. Connect to Your Server
Before setting up an SSH connection using PuTTY on Windows that we installed previously, gather the following information from your VPS Control Panel:
- Server IP Address or Hostname
- SSH port (usually 22)
- SSH username (usually root, if you have the administrator access to your Ubuntu VPS server)
- SSH password
In my case, I used Hyperhost for my self-hosting, so below is the information I could find from my VPS Control Panel to set up an SSH connection:

Add SSH public key to your VPS Control Panel (in my case, it’s Hyperhost )

Add SSH public key to your VPS Control Panel (in my case, it’s Hyperhost )
To remote access your VPS server, you need to launch the PuTTY SSH client.
After this, enter your Server’s IP Address and Port Number as below.

Add SSH public key to your VPS Control Panel (in my case, it’s Hyperhost )
At the left navigation, click “ SSH > Auth > Credentials “. Then, click “ Browse ” and load the SSH private key file (in.ppk format) we had created previously. After this, click “ Open ” button as below.

Add SSH public key to your VPS Control Panel (in my case, it’s Hyperhost )
Once the PuTTY terminal appears, simply login to your VPS server as “ root ” and enter the password (which you could possibly find in your VPS Control Panel).

Add SSH public key to your VPS Control Panel (in my case, it’s Hyperhost )
Congratulations! You have successfully connected to your VPS Server account using the PuTTY SSH client.

Add SSH public key to your VPS Control Panel (in my case, it’s Hyperhost )
4. Install Docker in your Ubuntu VPS Server
Then, copy and run this code in your PuTTY terminal to install Docker Engine on Ubuntu.
If you’re using a different Linux distribution other than Ubuntu, please refer to the detailed instructions in the Docker documentation.
sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg lsb-release
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
Source: n8n documentation

Add SSH public key to your VPS Control Panel (in my case, it’s Hyperhost )
PuTTY terminal
5. Install Docker Compose in your VPS Server
Next, enter the following command into your PuTTY terminal to install the latest version of Docker Compose in your VPS server.
sudo apt-get install docker-compose-plugin
6. Set Up Traefik Reverse Proxy via Docker Compose
(i) Create necessary folders and files
Enter the following commands into your PuTTY terminal to create the necessary files for the setup later.
mkdir -p data/configurations
touch docker-compose.yml
touch data/traefik.yml
touch data/acme.json
touch data/configurations/dynamic.yml
chmod 600 data/acme.json
Source: autofomm
(ii) Create the Docker Compose file for Traefik
To create a Docker Compose file for Traefik, enter nano ~/docker-compose.yml into your PuTTY terminal, and then paste the provided code into the file (Reminder: change yourdomain.com to your domain).
File location: ~/docker-compose.yml
version: '3.7'
services:
traefik:
image: traefik:v2.10
container_name: traefik
restart: always
security_opt:
- no-new-privileges:true
ports:
- 80:80
- 443:443
volumes:
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./data/traefik.yml:/traefik.yml:ro
- ./data/acme.json:/acme.json
# Add folder with dynamic configuration yml
- ./data/configurations:/configurations
networks:
- proxy
labels:
- "traefik.enable=true"
- "traefik.docker.network=proxy"
- "traefik.http.routers.traefik-secure.entrypoints=websecure"
# Change yourdomain.com to your domain
- "traefik.http.routers.traefik-secure.rule=Host(\`traefik.yourdomain.com\`)"
- "traefik.http.routers.traefik-secure.middlewares=user-auth@file"
- "traefik.http.routers.traefik-secure.service=api@internal"
networks:
proxy:
external: true
Source: autofomm
(iii) Create the static Traefik config file
To create another static configuration file., enter nano ~/data/traefik.yml into your PuTTY terminal, and paste the provided code (Reminder: change yourusername@yourdomain.com to your custom domain email address).
File location: ~/data/traefik.yml
Source: autofomm
(iv) Create the dynamic Traefik config file
To create another dynamic configuration file, enter `nano ~/data/configurations/dynamic.yml` into your PuTTY terminal, and paste the provided code below:
File location: ~/data/configurations/dynamic.yml
Source: autofomm
(v) Deploy Traefik
Enter the following commands to set up your PuTTY terminal to deploy Traefik on your VPS hosting.
cd ~
docker compose up -d
Just In case you failed to deploy Traefik via Docker, I leave a note on one of possibilities why this error happens.
(1) Apache HTTP server is still running at port 80
When you run docker compose up -d, if you saw a similar error message like this:
"Error starting userland proxy: listen tcp4 0.0.0.0:80: bind: address already in use"
It’s probably because there is some other service running on that server port 80. For my case, it’s Apache Web Server, so I run this code to stop Apache Web Server:
/etc/init.d/apache2 stop
(2) Network proxy cannot be found after running docker-compose up -d

Just run the following command into the Putty terminal.
docker network create proxy
docker compose up -d
After a while, go to traefik.yourdomain.com and see if your Traefik reverse proxy is successfully deployed!

Add SSH public key to your VPS Control Panel (in my case, it’s Hyperhost )
To sign in to this Traefik dashboard you just hosted, use:
- Username: admin
- Password: qwer1234
To change the credentials, navigate to the file: ~/data/configurations/dynamic.yml and replace the password hash: “ admin:htpasswd -nb "<YOUR USERNAME>" "<YOUR PASSWORD>".
7. Host n8n website
We will need to host the n8n website by creating a Docker Compose file.
Enter nano ~/n8n/docker-compose.yml into your PuTTY terminal and paste the provided code below.
File location: ~/n8n/docker-compose.yml
Source: n8n documentation
Then, enter nano ~/n8n/.env into your PuTTY terminal and paste the provided code as below (Reminder: you could change the value of DOMAINNAME and GENERIC_TIMEZONE here).
File location: ~/n8n/.env
# The top level domain to serve from
DOMAINNAME=yourdomain.com
# The subdomain to serve from
SUBDOMAIN=n8n
# DOMAINNAME and SUBDOMAIN combined decide where n8n will be reachable from
# above example would result in: https://n8n.yourdomain.com
# Optional timezone to set which gets used by Cron-Node by default
# If not set New York time will be used
GENERIC_TIMEZONE=Asia/Kuala_Lumpur
# The email address to use for the SSL certificate creation
SSL_EMAIL=yourusername@yourdomain.com
Source: autofomm
Enter the following commands in your PuTTY terminal to deploy n8n website on your VPS hosting.
cd ~/n8n
docker compose up -d
Hooray, your n8n website has been successfully deployed at n8n.yourdomain.com. But ya, what if you want to host more apps (e.g., NocoDB) on your single VPS server? Check the next section.
8. (Optional) Host NocoDB website
We will need to host the NocoDB website by creating a Docker Compose file.
Enter nano ~/nocodb/docker-compose.yml into your PuTTY terminal and paste the provided code below.
File location: ~/nocodb/docker-compose.yml
version: "3.7"
services:
nocodb:
container_name: nocodb
depends_on:
- nocodb-db
environment:
- "NC_DB=pg://nocodb-db:5432?u=${DATABASE_USER}&p=${DATABASE_PW}&d=${DATABASE_NAME}"
- "NC_PUBLIC_URL=https://nocodb.${DOMAINNAME}"
- NC_DISABLE_TELE=true
image: "nocodb/nocodb:latest"
labels:
- traefik.enable=true
#- traefik.http.services.nocodb.loadbalancer.server.port=8080
- traefik.http.routers.nocodb.rule=Host(\`nocodb.${DOMAINNAME}\`)
- traefik.http.routers.nocodb.entrypoints=websecure
- traefik.http.routers.nocodb.tls=true
- traefik.http.routers.nocodb.tls.certresolver=letsencrypt
- traefik.docker.network=proxy
- com.centurylinklabs.watchtower.enable=true
networks:
- proxy
restart: always
volumes:
- "nocodb-data:/usr/app/data"
nocodb-db:
container_name: nocodb-db
environment:
POSTGRES_DB: "${DATABASE_NAME}"
POSTGRES_PASSWORD: "${DATABASE_PW}"
POSTGRES_USER: "${DATABASE_USER}"
expose:
- "5433"
ports:
- "5433:5432"
healthcheck:
interval: 10s
retries: 10
test: "pg_isready -U ${DATABASE_USER} -d ${DATABASE_NAME}"
timeout: 2s
image: "postgres:12.1-alpine"
networks:
- proxy
- internal
restart: always
volumes:
- "nocodb-db:/var/lib/postgresql/data"
watchtower:
command: "--schedule \"0 5 * * *\" --cleanup --label-enable"
container_name: watchtower
image: containrrr/watchtower
labels:
- com.centurylinklabs.watchtower.enable=true
networks:
- internal
restart: always
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
volumes:
nocodb-data:
name: nocodb-data
nocodb-db:
name: nocodb-db
networks:
proxy:
external: true
Source: NocoDB’s Github Repo
Then, enter nano ~/n8n/.env into your PuTTY terminal and paste the provided code below (Reminder: you could change yourdomain.com to your domain).
File location: ~/nocodb/.env
DOMAINNAME=yourdomain.com
# Database
DATABASE_NAME=xcdb
DATABASE_USER=nocodb
DATABASE_PW=SECURE_PW
Enter the following commands in your PuTTY terminal to deploy NocoDB website on your VPS hosting. After completion, you shall see your NocoDB website to be hosted at nocodb.yourdomain.com (if you had properly set up the A record for this NocoDB subdomain at step 1).
cd ~/nocodb
docker compose up -d
Bonus: Update Websites
Let’s say your n8n website app has a new release version recently.
To update it, simply open your PuTTY SSH client to remotely access your VPS server. In the PuTTY terminal, enter the command below.
cd ~/n8n
docker compose pull
docker compose up -d
This works for any other apps you’ve installed on the same VPS hosting, as long as you used “ docker compose pull ” command on where the docker-compose.yml file is located.
Enhancing Scalability and Availability of N8N for Production
In today’s fast-paced technological landscape, ensuring high availability and scalability in workflow automation is essential. While this article focuses on setting up a standalone N8N instance, you can take it further by enabling queue mode, which allows you to distribute workload across multiple workers on a single server using Docker Compose or scale even further with Kubernetes. By integrating Redis, PostgreSQL, and worker servers, N8N can handle more complex workflows with improved reliability and performance.
If you’re interested in making N8N more resilient and scalable, I encourage you to explore its distributed deployment options and see how they can enhance your automation workflows.
- Distributed Workflow Management in N8N: Architecture Upgrade and Performance Optimization Guide https://medium.com/@ozanbozkurtt96/distributed-workflow-management-in-n8n-architecture-upgrade-and-performance-optimization-guide-c9436b02dd93
- n8n set-up in queue mode using docker and kubernetes https://blog.devops.dev/n8n-set-up-in-queue-mode-using-docker-and-kubernetes-8a4ba3ad12ae
Conclusion
There you have it! We have successfully hosted the n8n and NocoDB Docker apps on the same VPS server with Traefik reverse proxy routing traffic between multiple subdomains seamlessly.
The process can be easily replicated to host more Docker apps and websites by creating additional subdomain DNS records, Docker compose files and Traefik proxy rules. With Traefik handling all your traffic routing efficiently behind the scenes, managing multiple Docker apps has never been easier!
I hope you find this guide useful. Let me know in the comments if you have any other questions! Happy hosting your apps and experimenting with containers!
Reference
- Self host n8n with Docker-Compose https://docs.n8n.io/hosting/installation/server-setups/docker-compose/
- How To Use Traefik v2 as a Reverse Proxy for Docker Containers on Ubuntu 20.04 https://www.digitalocean.com/community/tutorials/how-to-use-traefik-v2-as-a-reverse-proxy-for-docker-containers-on-ubuntu-20-04
- Deploy multiple applications on the same VPS with Docker and Traefik 2 https://www.youtube.com/watch?v=mSeMnKX6DFw & https://tech.aufomm.com/traefik
- How to Use PuTTY to Access Your Server https://www.hostinger.my/tutorials/how-to-use-putty-ssh
- Traefik’s Docker Image https://hub.docker.com/_/traefik
- n8n’s Docker Image https://hub.docker.com/r/naskio/n8n-python
- NocoDB’s Docker Image: https://hub.docker.com/r/nocodb/nocodb
Tags