
n8n is an open-source workflow automation tool that enables you to connect various services and automate repetitive tasks through a visual node-based interface. The platform supports many integrations and provides both no-code and low-code capabilities for building complex workflows.
This article explains installing and configuring n8n on Ubuntu 24.04 with Docker, setting up Nginx as a reverse proxy, and securing the installation with TLS certificates.
Before you begin:
n8n.example.com.Update the system packages.
Install prerequisite packages for Docker repository management.
Add Docker's official GPG key.
Add the Docker repository to your system.
Update the package index.
Install Docker Engine, CLI, and Docker Compose plugin.
Add your user to the docker group to run Docker commands without sudo.
Apply the group changes to your current terminal session.
Verify the Docker installation.
This section covers setting up a dedicated directory structure for n8n configuration files and data persistence.
Create a directory for n8n.
Navigate to the n8n directory.
Create a data directory for n8n persistence.
Create a directory for local file storage.
The n8n container runs with UID 1000. Set proper ownership for the n8n data directory to match the container's user ID.
In this section, create a Docker Compose configuration file for n8n.
Create a new Docker Compose configuration file.
Add the following configuration to the file. Replace n8n.example.com with your actual domain.
Save and close the file.
The above configuration creates an n8n container with persistent storage, HTTPS protocol settings, and support for webhooks.
Nginx serves as a reverse proxy to handle HTTPS termination and forward requests to the n8n container. Install Nginx and create a server block configuration for your domain.
Install Nginx.
Create a new Nginx server block configuration. Replace n8n.example.com with your domain.
Add the following configuration to the file. Replace n8n.example.com with your domain.
Save and close the file.
The configuration includes WebSocket support and extended timeouts necessary for n8n's real-time updates and long-running workflows.
Create a symbolic link to enable the site.
Test the Nginx configuration for syntax errors.
Reload Nginx to apply the configuration.
In this section, configure your firewall rules to allow necessary traffic.
Allow HTTP traffic for initial setup and SSL certificate validation.
Allow HTTPS traffic for secure access.
Certbot automates TLS certificate generation and renewal using Let's Encrypt. Secure your n8n installation with HTTPS to protect data transmission and enable secure webhook endpoints.
Install Certbot and the Nginx plugin.
Obtain an TLS certificate for your domain. Replace n8n.example.com with your domain and admin@example.com with your email address.
Certbot automatically modifies your Nginx configuration to include TLS settings and sets up automatic certificate renewal.
Test automatic certificate renewal.
A successful dry run confirms that automatic renewal is configured correctly.
In this section, deploy the n8n container using Docker Compose and verify the installation.
Navigate to the n8n directory.
Start n8n in detached mode.
Check the container status.
View the container logs to verify successful startup.
Sample Output:
Complete the initial setup by creating an admin account and configuring basic settings.
Open a web browser and navigate to your n8n domain.
Create your admin account by providing your email, name, and password.
Access the n8n workflow editor to start creating automations.
You can browse the available workflows from the Templates section, or create your own workflow agent.
Use these commands to manage your n8n installation.
Monitor n8n logs in real-time.
Stop the n8n container.
Restart the n8n container.
Update to the latest n8n version.
You have successfully installed n8n on Ubuntu 24.04 with Docker, configured Nginx as a reverse proxy, and secured the installation with TLS certificates. Your n8n server is now ready to create workflow automations. The containerized deployment ensures easy maintenance, updates, and scalability as your automation needs grow. For more information, visit the n8n documentation.
0 Comments
Be the first to comment and share your perspective with the community.