Last Updated on 31st July, 2025
This is an updated version of the article that I published on Medium in 2023 which received a lot of traffic. This guide is for someone with cost constraints who wants to host their Directus project on Digital Ocean. I will guide you to self-host your Directus project on a $6/month Digital Ocean droplet.
Use my link for a DigitalOcean account and get $200 in credit for over 60 days.
Create a DigitalOcean Droplet
First, sign up for an account with DigitalOcean. Once your account is set up, go on to create a droplet. To create a droplet, first choose a Datacenter, preferably closest to you or your users.

Then choose an OS image, for this tutorial, I am choosing Ubuntu 24.04(LTS) x64 as my preference.

Now choose the droplet type and CPU options, I am going with the Shared CPU option, you can choose from the Dedicated CPU option as well.
I am choosing a $6/month from Regular CPU options, which is best for this tutorial.

Now choose an authentication method, we have to choose the SSH Key option. Go on and click on New SSH Key (if you haven't already added it) and follow the steps to generate an SSH key and add it.

Now finalize the droplet creation by renaming the hostname (i.e. giving a specific name to your droplet) and adding preferred tags (just optional things to customize). Finally, click on the Create Droplet button.

Wait for a few seconds, and Hurray! Your droplet has been created. Once your droplet is created it will be reflected in your dashboard and you can see your droplet is assigned an IP address, now if you navigate to that IP address on your browser it will display, This site can’t be reached message. It is because your droplet is empty at this stage.

Use my link for a DigitalOcean account and get $200 in credit for over 60 days.
Connect to your droplet via SSH
Go ahead and fire up a terminal window. Start by typing the below command,
# Login via SSH
ssh root@YOUR-DROPLETS-IP-ADDRESS

Create a new user
Once you are logged in to your droplet, type the below command to create a new user.
It is always considered a good practice to create a new user and not use root user to set up your server.
# Create a new user and follow the prompts
adduser <username>
Don't forget to replace <username> with your username and follow the prompts. Once done type the below command to add the newly created user to the superuser group to provide the admin privileges,
# Add newly created user to superuser group to provide the admin privileges
usermod -aG sudo <username>
Once done, it's time to log in with the newly created user. To do so use the below command,
# Log in as the newly created user
su - <username>
Hooray! You are doing great. It's time to install some packages now.
Update packages
Before installing other packages and tools let's first update the package list and update the installed packages. Use the below commands to do so,
# Update package lists
sudo apt-get update
# Update installed packages
sudo apt-get upgrade
Install Nodejs
According to Directus requirements Nodejs v18.17 or higher is needed. I am choosing the latest LTS version(as of 31 July 2025) of Nodejs for the same i.e. Nodejs v22.17.1(LTS). Also, I am installing Nodejs using NVM(Node Version Manager). Use the below commands to do so,
# Download and install nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
# in lieu of restarting the shell
\. "$HOME/.nvm/nvm.sh"
# Download and install Node.js:
nvm install 22
# Verify the Node.js version:
node -v # Should print "v22.17.1".
nvm current # Should print "v22.17.1".
# Verify npm version:
npm -v # Should print "10.9.2".
Create a Directory
Now create a directory in our web root to host our Directus project using the below command,
# Create directory
sudo mkdir -p /var/www/dir-name
Don't forget to replace the dir-name with the name of your project. Now provide ownership of this directory to your logged-in user. Do so by using the below command,
# Provide directory ownership
sudo chown $USER:$USER /var/www/dir-name
Also, provide correct permissions to this directory using the below commands and navigate into it,
# Set the correct permissions of your directory
sudo chmod 775 /var/www/dir-name
# Then navigate into it
cd /var/www/dir-name
Install Directus
Now it's time to install Directus into your directory. Use the below commands to do so,
# install directus using npx
npx directus init
wait for a few seconds while the command is running, and follow the onscreen instructions to complete the setup. First, you will be prompted to select a database for your Directus project, I am choosing SQLite for this tutorial, and then provide a name for the database or go ahead with the default name.

After selecting the database, you will be prompted to create your first admin user for your Directus project and provide a valid email and password for your admin account. Follow the prompts for the same. Also, ignore those npm related warnings as of now.

Hurray! you have successfully created your first Directus project on the DigitalOcean droplet. Now start your Directus project by typing the below command.
# Start Directus project using this command
npx directus start
Now your project is live at your droplet’s IP address and on port number 8055 (default is 8055 and it may differ in your case), to access it at this point, navigate to your droplet’s IP address followed by the port number like this,
http://YOUR-DROPLETS-IP-ADDRESS:8055/
and congratulations your new Directus project is live now.

But there are a few problems, at this point:
Once you close the terminal window or end the SSH connection you are no longer live
secondly, you have to type in the port number, every time you have to access your project.
Install pm2 package
To deal with our first problem we have to use the pm2 package, which is a Node.js Production Process Manager with a built-in Load Balancer. In simple terms, this will help our application keep on running even after we close on the terminal or end the SSH connection. To get started we have to install this package globally on our droplet.
To do so type the below command,
# install Nodejs Production Manager
npm install pm2 -g
Now to use this for our Directus project we have to create an ecosystem.config.js file in the root of our directus project. To do so type,
# Create a ecosystem.config.js file in the root of your directus project
touch ecosystem.config.js
and add the following lines to it,
module.exports = {
apps: [
{
name: "directus",
script: "npx",
args: "directus start",
cwd: "/var/www/directus",
env: {
NODE_ENV: "production",
PORT: "8055",
// Add your other environment variables here
DB_CLIENT: "sqlite",
},
instances: 1,
exec_mode: "fork",
watch: false,
max_memory_restart: "750M"
}
]
};
Don’t forget to save the file using CTRL+O (to save the file in the nano editor) and exit using CTRL+X. Once done, type the below command to run our project using pm2,
# start directus project using PM2
pm2 start ecosystem.config.js
Well done, we have successfully dealt with our first problem.

Now our project will keep on running even if we exit the terminal or end the SSH connection.
Please note that we are just using the bare minimum of pm2 here. It provides a lot of options for app monitoring and logs management. Please read more about it here.
Nginx Installation
Nginx [engine x] is a web server that can also be used as a reverse proxy, load balancer, mail proxy, and HTTP cache. We will use Nginx to deal with our second problem i.e. port number problem. To get started type the below command to install Nginx on your droplet,
# install Nginx
sudo apt install nginx
Once this command is done running, navigate to your droplet’s IP address (without the port number) using your browser and you will see the below page,

Now we will have to define our default port (8055 in my case) to Ngnix configuration. To do so edit the file at /etc/nginx/sites-available/default and change the location variable as follows,
location / {
proxy_pass http://localhost:8055;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection ‘upgrade’;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
Once done, restart Nginx using the below command,
# Restart Nginx
sudo systemctl restart nginx
And finally, we have dealt with our port problem. Now navigate to your droplet’s IP address(without the port number) and you will see your Directus project up and running.

Now go ahead and start your awesome project, website, or SAAS idea. Good Luck!
Conclusion
In conclusion, hosting your Directus project on DigitalOcean is a great option for developers looking for a reliable and cost-effective solution.
Use my link for a DigitalOcean account and get $200 in credit for over 60 days.
By following the step-by-step guide, you can easily get your project up and running on a $6/Month DigitalOcean Droplet. I hope that this guide has been helpful, and please feel free to share your experience and feedback in the comments below!