Installation

Prerequisites

  • VPS with Ubuntu 20.04 or higher

  • Node.js 18.x

  • MongoDB 4.4

  • Domain pointed to your server

Installation Guide

1. Initial Server Setup

Update your system packages to ensure you have the latest security updates:

sudo apt update && sudo apt upgrade -y

2. Install Node.js

Install Node.js 18.x and build essentials:

curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install -y nodejs
sudo apt install -y build-essential

3. Setup MongoDB

  • Create an account at MongoDB Atlas

  • Create a new cluster

  • Get your connection string

  • Replace the MONGODB_URI in your .env file with the Atlas connection string

4. Install and Configure Nginx

Set up Nginx as a reverse proxy:

5. Application Setup

Clone and configure the application:

Add the zip file contents to the directory /var/www/pastify

Create a .env file with the following values:

6. Create Nginx Configuration

Create a new Nginx configuration file:

Add the following configuration:

Enable the site and restart Nginx:

7. Install PM2 Globally

8. Start the Application

9. Enable PM2 Startup Script

Last updated