n8n Server Deployment Overview¶
Prerequisites¶
The following system parameters are required for the application to function correctly:
-
Operating System: Ubuntu (recommended).
-
Access Rights: Superuser (
root) privileges to install system packages and manage Docker. -
Domain: A configured domain name matching the panel template.
-
Ports:
-
80/tcp— HTTP (for redirection to HTTPS and Certbot validation). -
443/tcp— HTTPS (primary application access). -
5678/tcp— internal application port (accessible only locally via127.0.0.1).
-
FQDN of the final panel on hostkey.in domain¶
| Parameter | Value |
|---|---|
| Prefix | n8n |
| Domain | hostkey.in |
| Full Template | n8n{Server_ID_from_Invapi}.hostkey.in |
File and Directory Structure¶
All primary data and configurations are distributed across the following paths:
-
/data/nginx/user_conf.d/— Nginx user configurations. -
/data/nginx/letsencrypt/.well-known/acme-challenge/— Directory for SSL certificate validation. -
/root/n8n-compose-file/— Working directory containing thecompose.ymlfile. -
/data/n8n— Primary n8n application data. -
/data/n8n/files— User files uploaded to n8n.
Application Installation Process¶
The application is deployed using Docker and Docker Compose. The official image docker.n8n.io/n8nio/n8n:latest is used.
The process includes:
-
Preparation of system dependencies (fixing
dpkgerrors, installingcurlanddnsutils). -
Installation of Docker.
-
Creation of required directories with appropriate permissions.
-
Generation of Nginx and Docker Compose configuration files.
-
Starting containers via
docker compose up -d.
Access Rights and Security¶
-
Firewall (UFW): The system is configured with rules allowing incoming traffic on ports
80and443/tcp. -
Users:
-
n8n data directories (
/data/n8n) are owned by the user with UID1000and GID1000. -
Nginx configuration files are owned by the
rootuser.
-
-
Access Restriction: The n8n application listens on port
5678only on the127.0.0.1interface, which prevents direct access from the external network bypassing the proxy server.
Docker Containers and Execution¶
The system utilizes two main containers:
-
nginx:
-
Image:
jonasal/nginx-certbot:latest. -
Network Mode:
host. -
Purpose: Traffic proxying, SSL certificate management via Certbot.
-
-
n8n:
-
Image:
docker.n8n.io/n8nio/n8n:latest. -
Operation Mode: Production.
-
Application Update Instructions¶
The update is performed by running pull and restarting the containers. To update, execute the command in the directory containing the configuration file:
Permissions Settings¶
| Path | Owner (UID/GID) | Permissions |
|---|---|---|
/data | root:root | 0755 |
/data/n8n | 1000:1000 | 0755 |
/data/n8n/files | 1000:1000 | 0755 |
Configuration Files and Data Location¶
-
Docker Compose Configuration:
/root/n8n-compose-file/compose.yml. -
Nginx Certbot Environment Variables:
/data/nginx/nginx-certbot.env. -
SSL Certificates: Stored in Docker Volume
nginx_secrets(inside the container at path/etc/letsencrypt).
Available Connection Ports¶
| Port | Protocol | Purpose | Accessibility |
|---|---|---|---|
80 | TCP | HTTP | Public |
443 | TCP | HTTPS | Public |
5678 | TCP | n8n Internal | Local only (127.0.0.1) |
Starting and Stopping the Application¶
Container management is performed via docker compose in the /root/n8n-compose-file directory:
-
Start:
-
Stop:
Proxy Servers¶
nginx combined with certbot is used as the proxy server.
-
SSL: Automatic acquisition and renewal of certificates via Let's Encrypt. The renewal check interval is set to
8d. -
Configuration: Nginx is configured for automatic redirection from HTTP (port 80) to HTTPS (port 443). Header forwarding is configured for the correct operation of webhooks and WebSockets (
Upgrade,Connection).