n8n VPS installation: a step-by-step guide

17 min read

Installing n8n VPS doesn’t end with simply starting a container. The system must retain its data even after a reboot, be securely accessible and remain updatable. If you intend to use n8n on a long-term basis, Docker Compose can provide a transparent foundation, but setting up persistent data storage, the domain and access permissions requires special attention.

It is not always clear which deployment method is suitable for a VPS, or how to protect the credentials associated with your workflows. In this guide, we walk you through preparing your VPS, using Docker and Docker Compose, setting up persistent storage, and the key steps for configuring your domain and HTTPS. We’ll also show you how to secure access to the platform and how to plan for backups and updates.

The aim is to set up an n8n environment that you can understand and maintain, and which you can then develop further as your needs grow. These steps will help you assess the requirements for running a VPS and choose a solution suitable for testing or long-term use.

Why should you install n8n on a VPS, and what does self-hosting mean?

n8n is an automation tool that can be used to set up workflows and connect applications. For example, submitting a form can trigger data processing, send a notification and then record data in another system. The ‘What is n8n?’ summary provides background information on the tool’s purpose and how it works.

When self-hosted, n8n runs on a server that you manage yourself. On a VPS, this means you have access to the virtual machine and are responsible for installing, configuring, updating and performing backups for the application. With Docker Compose, service settings can be organised in a single configuration file. However, ensuring secure access and reliable operation remains an operational responsibility.

Installing an n8n VPS is therefore not merely a technical step. You also need to consider how much control you want over the environment and how much time you can devote to maintenance. A KVM VPS provides independent access to the virtual server, allowing you to tailor the settings to your own requirements. aWh’s KVM VPS solution is built on NVMe SSD storage and redundant storage, and offers DDoS protection.

Who is it suitable for? Running n8n on a VPS may be suitable for those who wish to retain control over the server environment and configuration, and who are prepared to manage the application, access rights, updates and backups themselves. If you prefer a ready-to-use, managed service, you should consider whether you are willing to take on regular operational tasks.

How does n8n on your own VPS differ from the cloud service?

With a managed cloud service, the provider manages part of the background infrastructure, so you may have fewer server management tasks. With your own VPS, you play a greater role in configuring the environment, which means you bear more responsibility. You’ll need to plan who has access to the n8n interface, when to install updates and how they are carried out, as well as how backups are created and restored. Greater control does not, in itself, automatically translate into data protection or cost benefits.

What tasks are best suited to using your own n8n instance?

Having your own instance can be useful if you want to automate regularly recurring processes. For example, a new prospect’s details can be entered into a spreadsheet, n8n can notify the team, and then forward the information to another application. A few simple workflows may be sufficient for testing purposes. For business-critical, continuous operations, you should also plan your backup and update procedures in advance. Resource requirements depend on the complexity of the workflows, the number of concurrent runs and the data processing load.

What kind of VPS configuration is needed to run n8n securely?

In an n8n VPS environment, it is advisable to manage the application, the data and public web access separately. The VPS provides the runtime environment; n8n runs in a Docker container; the mounted volume stores the application’s data; and the domain points to the VPS. The reverse proxy receives web requests and forwards them to the appropriate internal service.

Data streams and external access points:

Browser or external service → domain DNS settings → HTTPS connection → reverse proxy → n8n container

n8n container ↔ persistent volume mounted on a VPS

n8n container → external applications and services

Web requests arrive via the domain, and the proxy forwards them to n8n. If the proxy handles the traffic, there is no need to make n8n’s internal port directly accessible to the public. When designing external access points, take into account the admin interface and any webhooks that receive requests from external systems. Restrict access to internal services to only the necessary connections.

Docker Compose organises the related services into a single configuration file. This file can specify the n8n container image, the environment variables required for startup and the mounting of persistent volumes. If a separate proxy or database is also running, their settings can be included in the same configuration. This makes the entire setup more transparent and changes easier to track. Please check the syntax against the official Docker Compose documentation and the current n8n installation guide.

Replacing or recreating a container does not automatically preserve the data stored within it. You must therefore associate a separate volume with the n8n data directory in the Compose file. The volume stores the data on the VPS independently of the container’s lifecycle, but it is not a substitute for a separate backup. Set the read permissions for the files carefully and protect any confidential environment variables.

The relationship between domains, reverse proxies and HTTPS

The domain’s DNS record directs requests to the VPS address. The proxy receives web traffic coming to the domain and then forwards it to n8n’s internal address. When using HTTPS, the proxy and certificate settings must also be configured to work together. The external URL for n8n must use this same full, encrypted address; otherwise, links or webhook addresses created within the interface may be incorrect.

aWh’s KVM VPS environment provides access to standalone virtual server installations. The overall architecture remains clearer if you document the roles of the domain, proxy, container and data storage separately. This makes it easier to identify the affected component in the event of a configuration error or change.

Docker Compose, direct installation or pre-installed n8n: which is right for you?

When choosing an installation method, don’t just consider which one can be set up quickly. It’s also important to consider how much control you want over the configuration, and whether you’re prepared to carry out regular maintenance. The comparison below will help you choose the approach that best suits your needs.

How to get there Control and customisation Maintenance requirements Who might find this useful?
Docker Compose Containers, variables, networks and persistent volumes can be configured. You manage the configuration, updates, backups and access rights. For those who want to understand and customise the entire architecture on their own VPS.
Direct installation The server environment is set up directly on the operating system. The user is responsible for maintaining the application and its dependencies, such as the runtime environment. For technical users who have a specific reason for operating without containers.
Pre-installed solution Part of the initial setup can be carried out by the solution provider. Installation may be simpler, but the available settings depend on the service. For those who want to minimise the amount of initial server configuration required.

The table shows general guidelines and is no substitute for checking the latest n8n documentation. Details and support for direct installation may vary, so please consult the official n8n guide before using it in a production environment. aWh offers AMD Epyc KVM VPS servers on which you can install and configure n8n.

When is Docker Compose useful?

Docker Compose provides a particularly clear framework if, in addition to n8n, you are running other interconnected services, such as a reverse proxy or a database. The settings for these services can be managed, started and modified all in one place. This method is suitable for you if you wish to retain control over configuration, data storage and the update process. You can read more about how KVM-based virtual machines work in the description of the KVM VPS solution.

When is a simpler or managed approach preferable?

If you have little experience in managing servers, a managed solution can reduce the initial set-up tasks. However, this does not mean that every configuration, update or data management decision is automatically made on your behalf. Responsibilities depend on the solution you choose, so please review the installation guide and the latest n8n documentation together.

Choose your VPS resources based on your expected workload. Take into account the complexity of your workflows, the number of application connections, concurrent processes and the volume of data processed. Testing and business-critical, continuous use may have different requirements. aWh’s range of KVM VPS plans can serve as a starting point for planning your n8n VPS deployment.

Step-by-step guide to setting up an N8n VPS: from the server to your first workflow

The example below is based on an Ubuntu-based VPS. Commands and configuration keys may vary depending on the operating system, Docker release and n8n version used. Before installation, please check the latest n8n, Docker and operating system documentation. Do not copy environment variables or the container image version without checking them first.

Setting up a VPS and launching n8n with Docker Compose

  1. Connect to the VPS via SSH. Replace the username and server address with your own details. If the connection is successful, the server’s command prompt will appear. ssh username@server-ip-address
  2. Update the package list and the installed packages. On an Ubuntu or Debian system, you can start the update using the following commands: sudo apt update && sudo apt upgrade -y
  3. Install the Docker Engine and the Docker Compose plugin following the current guide for your distribution. Then check that both tools are available. The version commands will show the installed version. docker –version

    docker compose version

  4. Create a separate directory for the installation files. This command creates the directory and then changes to it.mkdir -p ~/n8n && cd ~/n8n

    Create a compose.yaml file here. For the service, specify the official n8n container image, preferably with a verified, fixed version tag. Set the persistent volume to the path /home/node/.n8n, as well as the environment variables N8N_HOST, N8N_PROTOCOL=https and WEBHOOK_URL to match your domain. If the reverse proxy is running on the same VPS, make internal port 5678 accessible only to the local address. Check the variable names against the current n8n documentation.

  5. Start the service described in the Compose file from the installation directory. This command runs the container in the background. docker compose up -d

    Next, check the logs. Look for start-up errors, missing variables and any issues relating to the database or volume.

    docker compose logs -f n8n

    After making any configuration changes, restart the service using the same Compose file. If the service name is different, use the name specified in your own file.

    docker compose restart n8n

Setting up the domain and HTTPS, followed by a test run

In the domain’s DNS settings, point the domain name you are using to the VPS’s public IP address. The reverse proxy should forward incoming requests to n8n’s local address and port, and handle the HTTPS certificate. Also check that n8n’s external address points to the full HTTPS domain. The specific proxy configuration depends on the software you are using.

Open the n8n interface on the domain, log in, then create a simple test workflow. Run it and save it, then check that it remains intact after reloading. If you connect an external service to it, check the authentication and the connection result. Finally, check the logs to see if any errors occurred during the test.

For a standalone server environment, aWh’s KVM VPS solution provides a virtual server on which you can plan your n8n installation to suit your own requirements.

Video: n8n 2.0 Docker Setup in 5 Minutes (Lawrence Systems)

Secure operation and choosing a VPS: how can you keep n8n manageable?

Running n8n independently remains straightforward if, alongside day-to-day use, there is a clear procedure in place for managing access, backups and updates. Make a note of where each setting is located, who is authorised to change it, and what checks you carry out after making a change. This way, in the event of an error, you can more easily determine whether the problem is caused by the application, the VPS configuration or an external connection.

What security and maintenance measures should you be aware of?

Keep your VPS administrator access and your n8n dashboard accounts separate. Use unique, strong credentials for both, and regularly review who has access. Treat any external service credentials stored in n8n as confidential. Only authorised users should have access to the Compose file and files containing environment variables.

  • Update procedure: Keep up to date with updates for the operating system, Docker and n8n. Before making any changes, review the release notes and then check your key workflows.
  • Checking backups: Back up your n8n data directory and database, and make sure you keep the configuration required for restoration. After backing up, try restoring the data to check that all the necessary data is available.
  • Tracking changes: Make a note of updates, configuration changes and any bug fixes. This makes it easier to identify the cause of a fault if a workflow subsequently behaves differently.
  • Review access rights: Remove accounts that are no longer needed and retain only the permissions necessary to carry out the task.

Adjust the frequency of backups to suit the rate of data changes and the potential consequences of data loss. There is no single interval that applies to every installation. In your operational plan, also set out how you will restore n8n and what checks you will carry out to ensure that authentication details and workflows are functional following restoration.

When might an aWh KVM VPS be suitable for n8n?

The aWh AMD Epyc KVM VPS may be suitable if you wish to install and configure n8n with direct server access. When selecting VPS resources, do not base your decision solely on current usage: take into account the complexity of your workflows, concurrent processes, related services and the volume of data processed. If the workload changes, review from time to time whether the capacity is sufficient for actual operations.

The KVM VPS guide can help you understand the virtual server environment. However, choosing a VPS is only part of planning your infrastructure; the installation, configuration and maintenance of n8n must still be tailored to your operational plan. For technical details, take a look at aWh’s AMD Epyc KVM VPS solution.

Plan your next step

Before launching production workflows, appoint someone to be responsible for monitoring changes and any errors that may arise. Consider which automated processes, if they fail, require immediate intervention, and what checks should be put in place to indicate if a process is not producing the expected result. Incorporate these considerations into your operations plan right from the start.

The next step in installing n8n on a VPS is to assess whether self-hosting is suited to your technical capabilities and automation goals. Take a look at aWh’s AMD Epyc KVM VPS solution and use it to design your n8n environment to suit your own needs.

Frequently asked questions about installing n8n on a VPS

Can n8n be installed on any VPS?

Not necessarily. The VPS must support your chosen operating system and installation method. When using Docker, the Docker runtime requirements must also be met. Resource requirements are influenced by the number and complexity of workflows, concurrent processes and the volume of data. Different capacities may be required for testing and ongoing business use, so you should base your decision on the expected workload.

Should I install n8n on a VPS using Docker Compose or directly?

Docker Compose can be a straightforward solution if you wish to manage n8n alongside other services. With a direct installation, the application’s runtime environment and its updates are more closely tied to the VPS operating system. Choose the approach that best suits your configuration and maintenance practices. Before doing so, check the latest n8n installation guide and the requirements for the chosen method.

Do you need a domain to use n8n on a VPS?

Not necessarily; it may also be accessible via the n8n server address. With a domain, you can use a web address that is easier to remember, and it is simpler to configure the HTTPS certificate, the reverse proxy and the n8n external URL. The DNS record must point to your VPS address. If you’d like your own address, you can find out more about aWh’s domain registration options.

How can I secure the n8n web interface?

Secure the interface with HTTPS and unique, strong login credentials, and restrict administrator access. Keep the SSH access used for the server separate from your n8n user accounts. Do not store passwords or other confidential settings in publicly accessible files or code repositories. Keep the system up to date and ensure that users have only been granted the permissions necessary for their work.

Will n8n workflows be preserved after the container is restarted?

Yes, provided that the n8n data directory is managed by a properly mounted persistent volume stored outside the container. The preservation of workflows depends not only on the reboot, but also on the correct configuration of the volume and the state of the database. After rebooting, log in, check that the workflows are displayed, and then try one out. The volume is not a substitute for a separate data backup.

Which database should I use to install n8n on a VPS?

The choice of database depends on the workload and operational requirements. The default database for n8n is SQLite, whilst PostgreSQL is a common choice for higher-load, production environments due to its scalability. When making your decision, you should also take into account backup, restoration and database maintenance. Always check the supported versions and configuration variables in the latest n8n documentation.

Can I update n8n using Docker Compose?

Yes, a Compose-based installation can be updated, but the procedure must be adapted to your configuration and the current n8n guide. Before updating, create a backup of your persistent data and the necessary configuration. Next, review the release notes, then, after making the changes, check the container logs, the login status and the status of any important workflows. Avoid unchecked version changes in a production environment.

To set up your own n8n environment, take a look at aWh’s AMD Epyc KVM VPS solution and choose a server environment suited to your planned workload.

Back to the blog