# DigitalOcean Virtual Machine Configuration
This DigitalOcean configuration documentation is related to the DigitalOcean One-click installation guide. It should guide you through the handling of the DigitalOcean virtual machine running the Strapi application.
You can click below for more information about the installed software and the Nginx server configuration.
The Strapi application running on the droplet has the following softwares installed and configured:
|Node.js||12||Installed via the offical apt repository (opens new window))|
|Yarn||latest stable version||Installed via the official apt repository (opens new window))|
|Nginx||latest version||Installed via Ubuntu default repository|
|UFW (Uncomplicated Firewall)||latest stable version||Configured to only allow incoming ports 80 (HTTP), 443 (HTTPS), and 22 (SSH)|
|PostgreSQL||latest version||Installed via Ubuntu default repository|
|PM2||latest version||Installed globally using Yarn|
Nginx default configuration
The DigitalOcean one-click application uses Nginx to proxy http on port 80 to Strapi. This is to ensure the system is secure as running any application on ports below 1024 require root permissions.
Here are the config files included by default:
To learn more about the Nginx proxy options you can view the Nginx proxy documentation (opens new window).
# Strapi service account
For security purposes, the DigitalOcean virtual machine hosting the Strapi application uses a service user. This user is extremely limited into what it can do and access.
The service user home directory is located at
/srv/strapi. The actual Strapi application is located within this home directory at
The Strapi application runs in the
development environment to allow for creating content types. It is not recommended to use it directly in production. For staging and production environments, it's recommended to configure a private git repository to commit changes into, and create a new application directory within the service user's home (e.g.
To run the new
staging environments you can refer to the PM2 Documentation (opens new window)
# Accessing the service account
To access your service account:
- SSH into the
rootuser. Depending on your Operating System or your SSH client, there may be multiple ways to do this. You should refer to your SSH client documentation for clarification on using SSH keys.
- Run the
sudo su strapicommand. This will take you to the
To go back to the
root user, run
Please note that by default the strapi user cannot run
sudo commands. This is intended.
# Controlling the Strapi service and viewing logs
While identified as the service user on the DigitalOcean virtual machine, PM2 (opens new window) can be used to control the Strapi process and view logs with the following commands:
pm2 list: Show a list of all running processes. The default service is called "strapi-development" and should be running with an ID of 0.
pm2 restart strapi-development: Restart the Strapi process manually.
pm2 stop strapi-development: Stop the Strapi process.
pm2 start strapi-development: Start the Strapi process. Strapi will automatically start if the virtual machine is rebooted.
pm2 logs strapi-development: Show the logs in real time; to exit, use Ctrl+C.
You can also manually view the log files under
/srv/strapi/.pm2/logs if you encounter any errors during the bootup.
# Strapi application access with ssh
To ssh into your Strapi application, run the following command:
<public-ipv4-address> should be replaced with the address found by clicking on the droplet name in the droplets list on DigitalOcean (opens new window).
There is no password for SSH as DigitalOcean uses SSH keys by default with password authentication disabled.
# PostgreSQL Password
To change the PostgreSQL password and update Strapi's config:
- Log into the
- Run the
pm2 stop strapi-developmentcommand to stop the current strapi process.
- Run this command to change the password for the
psql -c "ALTER USER strapi with password '<your-new-password>';"
<your-new-password> should be replaced by the password you want to use.
- Update the
/srv/strapi/strapi-development/.envfile with the new password:
- Restart Strapi and confirm the password change was successful by running these commands:
pm2 start strapi-development pm2 logs strapi-development