销售:050-1791-1110

Deploy Open Source Projects

Overview

This tutorial shows you how to clone an open-source project from GitHub and deploy it on your own server, using a typical Node.js project as an example.

Prerequisites

  • A Linux server (Ubuntu 22.04/24.04 recommended)
  • Git and Node.js (or other runtime) installed
  • Basic command-line skills

Step 1: Clone the Repository

git clone https://github.com/example/awesome-project.git
cd awesome-project

Step 2: Install Dependencies

npm install

Step 3: Configure Environment

cp .env.example .env
nano .env

Common settings: DATABASE_URL, SECRET_KEY, PORT.

Step 4: Build and Run

npm run build
npm install -g pm2
pm2 start npm --name "my-app" -- start
pm2 save && pm2 startup

Step 5: Reverse Proxy with Nginx

server {
    listen 80;
    server_name app.example.com;
    location / {
        proxy_pass http://127.0.0.1:3000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

Step 6: SSL Certificate

sudo certbot --nginx -d app.example.com
Scroll to Top