Jose Jollja Logo
Complete Guide: Configuring a VPS from Scratch
UNIVERSITY VS. REAL MARKET

Complete Guide: Configuring a VPS from Scratch

Do you want total control over your applications in the cloud, optimize server performance, and stop paying for expensive shared hosting licenses? Configuring your own Virtual Private Server (VPS) is the definitive step to graduate from junior developer and understand how the internet works in a real production environment.

In academia, we often deploy projects using automated platforms that hide the infrastructure. However, in the job market and business environments, mastering Linux server administration is one of the most demanded and respected skills. In this detailed technical guide, you will learn to connect the entire ecosystem to put your website into production safely and realistically.

🧠The Server Ecosystem: What is everything?

1. VPS (Virtual Private Server): It's your computer in the cloud. Unlike shared hosting where you share resources and have software restrictions, a VPS gives you access as root (absolute administrator) to a clean operating system. You decide what gets installed and how it's configured.

2. SSH (Secure Shell): It is the protocol and secure channel that allows us to control the VPS from our local computer through the command terminal in a completely encrypted way.

3. Nginx: It is a very high-performance web server. In our architecture, it acts as a Reverse Proxy. Think of it as the receptionist of a building: it receives all users arriving from the internet on standard ports and internally redirects them to the correct office (or local port) within the server.

4. Certbot (Let's Encrypt): Automated tool responsible for requesting, installing, and renewing SSL/TLS certificates for free. It transforms your site from an insecure http:// to an encrypted https://, activating the security padlock in the browser.

5. PM2 (Process Manager 2): Advanced process manager for Node.js. In development, you run your app with a command that blocks the terminal; if you close it, the app dies. PM2 wraps your application so it runs in the background permanently and revives it instantly if the code ever crashes.

1. Server Access and Environment Preparation

Before starting in the console, you must ensure that your domain provider has the A record (which links your domain with the public IP) in your DNS zone pointing to your VPS server.

Secure Connection via SSH

bash
ssh root@<your_vps_ip>

System Update and Dependency Installation

bash
sudo apt update
sudo apt install nginx python3-certbot-nginx git -y

Node.js Version Management
We will install NVM (Node Version Manager) to manage and download the exact version of Node required by your code, avoiding incompatibilities.

2. Nginx Configuration as Reverse Proxy

By default, your Node or Next.js app will run locally on a port like 3000. Nginx will intercept public traffic on port 80 (HTTP) and transparently delegate it to the internal port.

Create the configuration file:

bash
sudo nano /etc/nginx/sites-available/filename

Add the following code block:

nginx
server {
 listen 80;
 server_name josejollja.com www.josejollja.com;
 location / {
  proxy_pass http://localhost:3000;
  proxy_http_version 1.1;
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection 'upgrade';
  proxy_set_header Host $host;
  proxy_cache_bypass $http_upgrade;
 }
}

3. Site Activation and SSL (HTTPS) Enablement

Link the file and restart the web service:

bash
sudo ln -s /etc/nginx/sites-available/filename /etc/nginx/sites-enabled/
sudo systemctl restart nginx

Automatic Security with Certbot

bash
sudo certbot --nginx -d josejollja.com -d www.josejollja.com

4. Deployment, Persistence with PM2 and Live Launch!

Clone your repository to the production root, install dependencies, and build the project to optimize it:

bash
git clone <your_repository_url>
cd your-project
npm i && npm run build

Permanent Engine Activation

bash
npm install -g pm2
pm2 --name "YOURWEB:3000" start npm -- start

🚀 Eureka Moment: Your Web is officially in production!

By running this command with PM2, the entire infrastructure chain is completely linked and operational:

  • PM2 keeps your application running listening to local port 3000 in the background.
  • Nginx and Certbot watch public inputs 80 (HTTP) and 443 (HTTPS).
  • When a user types your domain, the request is encrypted via the SSL certificate, Nginx takes the secure request, asks PM2 for it, and returns it to the client in milliseconds.

Open your browser, type your domain, and you will see your application running professionally, securely, and under your own control.

What infrastructure do you prefer to use in your real projects?

Mastering server configuration gives you a unique technical criteria as a Full Stack developer. Save this article and share it to optimize your future deployments.

- José Jollja

¿Te gustó este artículo?

Conectemos en mis redes sociales donde comparto más contenido, tutoriales y tips de ingeniería de software a diario.