Prerequisites
Before you begin, ensure you have the following installed on your VPS:- Node.js: Make sure you have Node.js version 18 or higher installed. It is recommended to use Node.js version 21 for stability.
- Nginx: Install Nginx to use as a reverse proxy server.
- PM2: Install PM2 to manage your Next.js application process and keep it running 24/7.
- Next.js: The application is built with Next.js, so you’ll need it installed.
Install Required Packages
Run the following commands to install everything:Step 1: Download and Set Up the Application
-
Download the Application:
- Go to the Donate Me download page.
- Choose the version you want to download and click the download button. It is recommended to always download the latest version for stability.
-
Upload the Application:
- Log in to your VPS using an SCP client like WinSCP or any other provider.
- Navigate to the folder where you want to place the application, for example,
/var/www
. - Upload the downloaded zip file to this folder and unzip it.
-
Navigate to the Application Directory:
- Open your terminal and navigate to the directory where the application is uploaded:
- Open your terminal and navigate to the directory where the application is uploaded:
-
Install Dependencies and Build the Application:
- Run the following commands:
- Run the following commands:
Step 2: Configure Nginx as a Reverse Proxy
Without SSL
-
Edit the Nginx Configuration File:
- Open the config file using Nano:
- Add the following configuration:
- Open the config file using Nano:
-
Enable the Configuration:
-
Restart Nginx:
With SSL
-
Install Certbot:
-
Obtain an SSL Certificate:
-
Verify and Adjust Nginx Config (if needed):
Certbot modifies your config. Ensure it looks like this:
-
Restart Nginx:
Step 3: Manage the Application with PM2
-
Start the Application:
-
Autostart on Reboot:
Step 4: Verify the Installation
-
Check Application Status:
-
Access the Application:
- Visit
http://your-domain.com
orhttps://your-domain.com
depending on your setup.
- Visit
Additional Resources
- For more information on deploying Next.js apps with Nginx and PM2, check out this guide.