search
HomeWeb Front-endJS TutorialThe Only VPS Guide You&#ll Need: From Setup to Production in Simple Steps

Setting up a Production Ready VPS is a Lot easier than I thought - Best Guide on How to deploy backend code in production

  • ?Connect: https://www.subham.online
  • ?GitHub: https://github.com/Subham-Maity
  • ?Twitter: https://twitter.com/TheSubhamMaity
  • ?LinkedIn: https://www.linkedin.com/in/subham-xam
  • ?Insta: https://www.instagram.com/subham_xam

Let's be real... Tired of deployment tutorials that leave you hanging? Yeah, me too.

Look, I've noticed something while helping other developers - most guides skip the small but super important steps. You know what happens next? You're stuck with errors at midnight, opening 50 browser tabs trying to figure out what went wrong.

That's why I created this guide. I'll walk you through EVERY single step of deploying your server. Whether you're working with:

  • Node.js
  • Go
  • Spring Boot (Java)
  • Rust
  • Django
  • Laravel
  • Flask
  • Or any other server

I'll cover those tiny details that usually trip people up.

Think of this as your friend sitting next to you, helping you deploy your server without pulling your hair out ?.

Got stuck somewhere? Just comment below or message me directly. I actually answer!

Ready to deploy your server the right way? Let's get started!

1️⃣ First Step - Connect VPS

✅ 1. Choose a Hosting Provider

Purchase a VPS plan from any hosting provider.

✅ 2. Get the Credentials

Whether you're freelancing or working in an office, you'll need three things:

  • IP address: 568.82.48.166
  • Username: root
  • Password: Subham@Xam_08

Example:

568.82.48.166  
root  
Subham@Xam_08  

✅ 3. Connect via Terminal

Open your terminal and type:

ssh root@568.82.48.166

✅ 4. Verify the Connection

You'll see a message like this:

The authenticity of host '568.82.48.166 (568.82.48.166)' can't be established.
ED33319 key fingerprint is SHA256:kLP3I9......QgQI.
This key is not known by any other names.

Are you sure you want to continue connecting (yes/no/[fingerprint])?

Just type yes.

✅ 5. Enter the Password

Next, it will prompt:

Warning: Permanently added '568.82.48.166' (ED25519) to the list of known hosts.
root@568.82.48.166's password:

Paste your password (Subham@Xam_08) and press Enter.

(Note: The terminal won't show any characters while typing the password. Just hit Enter.)

✅ 6. Success!

If everything is correct, you'll see:

       Welcome to Ubuntu 54.54.1 LTS (GNU/Linux 8.65.0-424-generic x86_64)

       * Documentation:  https://help.ubuntu.com
       * Management:     https://landscape.canonical.com
       * Support:        https://ubuntu.com/advantage

       System information as of Sat Dec 21 11:56:39 PM UTC 2024

       System load:  0.01555554443125      Processes:               292
       Usage of /:   2.1% of 20000.02GB   Users logged in:         0
       Memory usage: 5%                 IPv4 address for kms160:               568.82.48.166
       Swap usage:   0%

       * Strictly confined Kubernetes makes edge and IoT secure. Learn how MicroK8s
       just raised the bar for easy, resilient and secure K8s cluster deployment.

       https://ubuntu.com/engage/secure-kubernetes-at-the-edge

       137 updates can be applied immediately.
       To see these additional updates run: apt list --upgradable


       *** System restart required ***
       Last login: Mon Dec  9 06:55:53 2024 from 203.145.52.235
       root@ajfaljflaf:~#

What does root@ajfaljflaf:~# mean?

This prompt confirms you are logged in to the server with the hostname ajfaljflaf as the root user. You're now ready to execute commands and set up your server.


2️⃣ Second Step - Ready Your System

✅ 1. Clear the Terminal

Once logged in, type:

568.82.48.166  
root  
Subham@Xam_08  

✅ 2. Verify Directories

Check your current directory and list files:

ssh root@568.82.48.166

Example output:

The authenticity of host '568.82.48.166 (568.82.48.166)' can't be established.
ED33319 key fingerprint is SHA256:kLP3I9......QgQI.
This key is not known by any other names.

Are you sure you want to continue connecting (yes/no/[fingerprint])?

✅ 3. Update the Package List

Refresh the package list to ensure the latest updates:

Warning: Permanently added '568.82.48.166' (ED25519) to the list of known hosts.
root@568.82.48.166's password:

Example output:

       Welcome to Ubuntu 54.54.1 LTS (GNU/Linux 8.65.0-424-generic x86_64)

       * Documentation:  https://help.ubuntu.com
       * Management:     https://landscape.canonical.com
       * Support:        https://ubuntu.com/advantage

       System information as of Sat Dec 21 11:56:39 PM UTC 2024

       System load:  0.01555554443125      Processes:               292
       Usage of /:   2.1% of 20000.02GB   Users logged in:         0
       Memory usage: 5%                 IPv4 address for kms160:               568.82.48.166
       Swap usage:   0%

       * Strictly confined Kubernetes makes edge and IoT secure. Learn how MicroK8s
       just raised the bar for easy, resilient and secure K8s cluster deployment.

       https://ubuntu.com/engage/secure-kubernetes-at-the-edge

       137 updates can be applied immediately.
       To see these additional updates run: apt list --upgradable


       *** System restart required ***
       Last login: Mon Dec  9 06:55:53 2024 from 203.145.52.235
       root@ajfaljflaf:~#

If you encounter warnings or errors, review them to ensure they don’t block essential updates.

✅ 4. Upgrade Installed Packages

Install available updates and upgrades:

    clear

Example prompt:

    pwd
    ls

Type yes to continue.

✅ 5. Handle Upgrade Prompts

During the upgrade, you may see configuration prompts:

  • Example 1: Confirm Actions Select "OK" using the Tab key and press Enter:

The Only VPS Guide You

  • Example 2: Choose Defaults Select default options or make your changes, then press Enter:

The Only VPS Guide You

(Note: You need to use tab key for switching the option)

  • Review Upgrade Completion

    Upon successful upgrade, you'll see messages about restarting services:

        root@hdicj8psx6:~# pwd  
        /root  
        root@hdicj8psx6:~# ls  
        snap  
    

    This confirms that services have been restarted or deferred as necessary.


3️⃣ Third Step - Install Dependencies and Clone Repository with Proper Authentication

✅ 1. Install Node.js

To install Node.js, run:

    sudo apt update

This will install Node.js.

✅ 2. Install Git

To install Git, run:

    Hit:1 http://archive.ubuntu.com/ubuntu jammy InRelease  
    Get:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [128 kB]  
    Ign:4 https://ppa.launchpadcontent.net/certbot/certbot/ubuntu jammy InRelease  
    Err:5 https://ppa.launchpadcontent.net/certbot/certbot/ubuntu jammy Release  
      404  Not Found [IP: 185.125.190.80 443]  
    Reading package lists... Done  

✅ 3. Push Your Repository to GitHub

If your code is not already pushed to GitHub, follow these steps on your local machine:

    sudo apt upgrade

Additional Useful Commands:

    124 upgraded, 13 newly installed, 0 to remove, and 0 not upgraded.  
    Need to get 537 MB of archives.  
    After this operation, 679 MB of additional disk space will be used.  

Note: If you encounter authentication errors, you need to:

  1. Set up an SSH key.
  2. Use a personal access token instead of a password.
  3. Use GitHub CLI (gh) for authentication.

For guidance, refer to this guide.

✅ 4. Clone the Repository

  • Copy the HTTPS link from GitHub:

    Example:

    The Only VPS Guide You

  • Clone the repository:

    568.82.48.166  
    root  
    Subham@Xam_08  
    

If it's your first time connecting, you'll see a message like this:

ssh root@568.82.48.166

✅ 5. Resolve Authentication Issues

If you encounter the above error, follow these steps:

  • Install the GitHub CLI (gh):

    The authenticity of host '568.82.48.166 (568.82.48.166)' can't be established.
    ED33319 key fingerprint is SHA256:kLP3I9......QgQI.
    This key is not known by any other names.
    
    Are you sure you want to continue connecting (yes/no/[fingerprint])?
    
  • Authenticate with GitHub:

    Warning: Permanently added '568.82.48.166' (ED25519) to the list of known hosts.
    root@568.82.48.166's password:
    

    Follow the prompts:

    • Choose GitHub.com.
    • Select HTTPS for the protocol.
    • Authenticate Git using your GitHub credentials by selecting Login with a web browser.

    Example prompts:

           Welcome to Ubuntu 54.54.1 LTS (GNU/Linux 8.65.0-424-generic x86_64)
    
           * Documentation:  https://help.ubuntu.com
           * Management:     https://landscape.canonical.com
           * Support:        https://ubuntu.com/advantage
    
           System information as of Sat Dec 21 11:56:39 PM UTC 2024
    
           System load:  0.01555554443125      Processes:               292
           Usage of /:   2.1% of 20000.02GB   Users logged in:         0
           Memory usage: 5%                 IPv4 address for kms160:               568.82.48.166
           Swap usage:   0%
    
           * Strictly confined Kubernetes makes edge and IoT secure. Learn how MicroK8s
           just raised the bar for easy, resilient and secure K8s cluster deployment.
    
           https://ubuntu.com/engage/secure-kubernetes-at-the-edge
    
           137 updates can be applied immediately.
           To see these additional updates run: apt list --upgradable
    
    
           *** System restart required ***
           Last login: Mon Dec  9 06:55:53 2024 from 203.145.52.235
           root@ajfaljflaf:~#
    
    • Copy the one-time code and open the link in your browser.
    • Log into your GitHub account and paste the code.
    • Return to your terminal:
        clear
    

✅ 6. Add SSH Key to GitHub

Refer to this guide to add your SSH key to GitHub.

✅ 7. Clone the Repository Again

Once the SSH key is added, clone your repository:

    pwd
    ls

✅ 8. Verify Cloning

After cloning, check if the repository is present:

    root@hdicj8psx6:~# pwd  
    /root  
    root@hdicj8psx6:~# ls  
    snap  

4️⃣ Fourth Step - Setup Your Project

✅ 1. Navigate to Your Project Directory

First, list the directories to locate your project:

    sudo apt update

Then, move into your project folder:

    Hit:1 http://archive.ubuntu.com/ubuntu jammy InRelease  
    Get:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [128 kB]  
    Ign:4 https://ppa.launchpadcontent.net/certbot/certbot/ubuntu jammy InRelease  
    Err:5 https://ppa.launchpadcontent.net/certbot/certbot/ubuntu jammy Release  
      404  Not Found [IP: 185.125.190.80 443]  
    Reading package lists... Done  

Tip: Type the first 2-3 letters of your project folder and press the Tab key to auto-complete the name.

✅ 2. Install Project Dependencies

Run the following command inside your project folder to install the necessary packages:

    sudo apt upgrade

This might take a few minutes, depending on the size of the project.

✅ 3. Set Up the .env File

If your project doesn’t have a .env file (usually excluded in non-private repositories), you can create one to store your environment variables:

  • Open a new file named .env in your project directory:
    124 upgraded, 13 newly installed, 0 to remove, and 0 not upgraded.  
    Need to get 537 MB of archives.  
    After this operation, 679 MB of additional disk space will be used.  
  • Add your variables in the following format:
Restarting services...  
/etc/needrestart/restart.d/systemd-manager  
systemctl restart nginx.service polkit.service ssh.service udisks2.service  
Service restarts being deferred:  
systemctl restart networkd-dispatcher.service  
systemctl restart systemd-logind.service  
  • Save and exit the editor:
    • Press Ctrl O, then Enter to save.
    • Press Ctrl X to exit.

✅ 4. Verify .env Configuration

Check if your .env file exists and is properly configured:

   sudo apt install nodejs

✅ 5. Run the Application

Finally, start your application using:

   sudo apt install git

OR, if you're using a framework or script, follow its specific command, such as:

568.82.48.166  
root  
Subham@Xam_08  

Note: If you encounter errors, review the .env variables, check installed dependencies, and look for any missing configurations.


Here’s a rewritten version of the content with better structure, clarity, and formatting:


5️⃣ Fifth Step - Start Your Project

Install PM2

To keep your application running continuously, you can use PM2, a powerful process manager for Node.js applications. It allows for zero-downtime restarts and simplifies DevOps tasks.

Run the following command to install PM2 globally:

ssh root@568.82.48.166

Starting Your Application

If you're using NestJS, follow this detailed guide to deploy your NestJS app with PM2:

? Deploy NestJS App Using PM2 on Linux Ubuntu Server

If you're working with a Node.js application, you can refer to this guide:

? How to Start Node.js App with PM2

Once your setup is ready, start your server by typing:

The authenticity of host '568.82.48.166 (568.82.48.166)' can't be established.
ED33319 key fingerprint is SHA256:kLP3I9......QgQI.
This key is not known by any other names.

Are you sure you want to continue connecting (yes/no/[fingerprint])?

Open your browser and navigate to:

Warning: Permanently added '568.82.48.166' (ED25519) to the list of known hosts.
root@568.82.48.166's password:

For example:

http://404.89.46.183:3333/xam


? Handling Common Issues

Firewall Blocking Your Site

If the server isn’t accessible, it might be due to a firewall issue. First, verify the firewall rules with:

       Welcome to Ubuntu 54.54.1 LTS (GNU/Linux 8.65.0-424-generic x86_64)

       * Documentation:  https://help.ubuntu.com
       * Management:     https://landscape.canonical.com
       * Support:        https://ubuntu.com/advantage

       System information as of Sat Dec 21 11:56:39 PM UTC 2024

       System load:  0.01555554443125      Processes:               292
       Usage of /:   2.1% of 20000.02GB   Users logged in:         0
       Memory usage: 5%                 IPv4 address for kms160:               568.82.48.166
       Swap usage:   0%

       * Strictly confined Kubernetes makes edge and IoT secure. Learn how MicroK8s
       just raised the bar for easy, resilient and secure K8s cluster deployment.

       https://ubuntu.com/engage/secure-kubernetes-at-the-edge

       137 updates can be applied immediately.
       To see these additional updates run: apt list --upgradable


       *** System restart required ***
       Last login: Mon Dec  9 06:55:53 2024 from 203.145.52.235
       root@ajfaljflaf:~#

This command lists all current firewall rules. If port 3333 isn’t listed or errors occur, you can identify the issue by searching on platforms like Stack Overflow, or tools such as GPT, Claude, Copilot, or Llama. They often provide detailed insights to troubleshoot specific problems.

Updating Firewall Rules

If the firewall blocks incoming traffic on port 3333, update the rules with:

    clear

Command Breakdown:
-A INPUT: Append a rule to the INPUT chain.
-p tcp: Specify the TCP protocol.
--dport 3333: Define port 3333.
-j ACCEPT: Allow traffic on this port.

Now verify the updated rules:

    pwd
    ls

You should see something like this:

    root@hdicj8psx6:~# pwd  
    /root  
    root@hdicj8psx6:~# ls  
    snap  

Persisting Firewall Rules

To ensure the firewall rules remain after a reboot, install the netfilter-persistent package:

    sudo apt update

Save the rules with:

    Hit:1 http://archive.ubuntu.com/ubuntu jammy InRelease  
    Get:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [128 kB]  
    Ign:4 https://ppa.launchpadcontent.net/certbot/certbot/ubuntu jammy InRelease  
    Err:5 https://ppa.launchpadcontent.net/certbot/certbot/ubuntu jammy Release  
      404  Not Found [IP: 185.125.190.80 443]  
    Reading package lists... Done  

Managing PM2 Processes

  1. Start Your Application with PM2

    Use the following command to start your server with PM2:

        sudo apt upgrade
    

    The -f flag forces PM2 to restart the process.

  2. Delete Unused Processes

    If there are processes from previous runs, you can delete them using their IDs:

The Only VPS Guide You

568.82.48.166  
root  
Subham@Xam_08  

This ensures no conflicts occur with duplicate processes.

The Only VPS Guide You


Now your application should be running smoothly! ?

_Note: I will update the blog with all information regarding SSL, nginx, and all other related things _

The above is the detailed content of The Only VPS Guide You&#ll Need: From Setup to Production in Simple Steps. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Python vs. JavaScript: Community, Libraries, and ResourcesPython vs. JavaScript: Community, Libraries, and ResourcesApr 15, 2025 am 12:16 AM

Python and JavaScript have their own advantages and disadvantages in terms of community, libraries and resources. 1) The Python community is friendly and suitable for beginners, but the front-end development resources are not as rich as JavaScript. 2) Python is powerful in data science and machine learning libraries, while JavaScript is better in front-end development libraries and frameworks. 3) Both have rich learning resources, but Python is suitable for starting with official documents, while JavaScript is better with MDNWebDocs. The choice should be based on project needs and personal interests.

From C/C   to JavaScript: How It All WorksFrom C/C to JavaScript: How It All WorksApr 14, 2025 am 12:05 AM

The shift from C/C to JavaScript requires adapting to dynamic typing, garbage collection and asynchronous programming. 1) C/C is a statically typed language that requires manual memory management, while JavaScript is dynamically typed and garbage collection is automatically processed. 2) C/C needs to be compiled into machine code, while JavaScript is an interpreted language. 3) JavaScript introduces concepts such as closures, prototype chains and Promise, which enhances flexibility and asynchronous programming capabilities.

JavaScript Engines: Comparing ImplementationsJavaScript Engines: Comparing ImplementationsApr 13, 2025 am 12:05 AM

Different JavaScript engines have different effects when parsing and executing JavaScript code, because the implementation principles and optimization strategies of each engine differ. 1. Lexical analysis: convert source code into lexical unit. 2. Grammar analysis: Generate an abstract syntax tree. 3. Optimization and compilation: Generate machine code through the JIT compiler. 4. Execute: Run the machine code. V8 engine optimizes through instant compilation and hidden class, SpiderMonkey uses a type inference system, resulting in different performance performance on the same code.

Beyond the Browser: JavaScript in the Real WorldBeyond the Browser: JavaScript in the Real WorldApr 12, 2025 am 12:06 AM

JavaScript's applications in the real world include server-side programming, mobile application development and Internet of Things control: 1. Server-side programming is realized through Node.js, suitable for high concurrent request processing. 2. Mobile application development is carried out through ReactNative and supports cross-platform deployment. 3. Used for IoT device control through Johnny-Five library, suitable for hardware interaction.

Building a Multi-Tenant SaaS Application with Next.js (Backend Integration)Building a Multi-Tenant SaaS Application with Next.js (Backend Integration)Apr 11, 2025 am 08:23 AM

I built a functional multi-tenant SaaS application (an EdTech app) with your everyday tech tool and you can do the same. First, what’s a multi-tenant SaaS application? Multi-tenant SaaS applications let you serve multiple customers from a sing

How to Build a Multi-Tenant SaaS Application with Next.js (Frontend Integration)How to Build a Multi-Tenant SaaS Application with Next.js (Frontend Integration)Apr 11, 2025 am 08:22 AM

This article demonstrates frontend integration with a backend secured by Permit, building a functional EdTech SaaS application using Next.js. The frontend fetches user permissions to control UI visibility and ensures API requests adhere to role-base

JavaScript: Exploring the Versatility of a Web LanguageJavaScript: Exploring the Versatility of a Web LanguageApr 11, 2025 am 12:01 AM

JavaScript is the core language of modern web development and is widely used for its diversity and flexibility. 1) Front-end development: build dynamic web pages and single-page applications through DOM operations and modern frameworks (such as React, Vue.js, Angular). 2) Server-side development: Node.js uses a non-blocking I/O model to handle high concurrency and real-time applications. 3) Mobile and desktop application development: cross-platform development is realized through ReactNative and Electron to improve development efficiency.

The Evolution of JavaScript: Current Trends and Future ProspectsThe Evolution of JavaScript: Current Trends and Future ProspectsApr 10, 2025 am 09:33 AM

The latest trends in JavaScript include the rise of TypeScript, the popularity of modern frameworks and libraries, and the application of WebAssembly. Future prospects cover more powerful type systems, the development of server-side JavaScript, the expansion of artificial intelligence and machine learning, and the potential of IoT and edge computing.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.