My First VPS Deployment Journey
My First VPS Deployment Journey: From Localhost to Production
From Development to a Live Server — A Real Learning Experience
As a frontend developer, I had built websites before, but deploying a complete full-stack application with a database, backend API, authentication, Redis, SSL, Nginx, and a VPS was something I had never done on my own.
Recently, I got the opportunity to deploy a dynamic web application on a Hostinger VPS. What looked simple at first turned into one of the most valuable learning experiences of my development journey.
This is the story of how I transformed a fresh Ubuntu server into a production-ready application and the deployment process I can now follow for future projects.
The Project
The application was not just a simple static website.
It included:
Public Website
Admin Dashboard
Backend API
PostgreSQL Database
Redis Cache
Authentication System
File Upload Support
SSL Security
Automated Process Management
Technology Stack:
React.js
Node.js
Express.js
PostgreSQL
Prisma ORM
Redis
Nginx
PM2
Ubuntu 22.04 LTS
Step 1: Preparing the Server
After purchasing a VPS, I received a fresh Ubuntu server.
The first task was connecting through SSH and preparing the server.
Basic setup included:
Updating packages
Installing Git
Installing build tools
Configuring firewall rules
Creating a deployment user
Disabling root login
This became my standard checklist for every new server.
Step 2: Installing Required Services
I installed the services required by the application:
Node.js
PNPM
PostgreSQL
Redis
Nginx
PM2
Certbot
At this stage, I learned how each service contributes to a production environment.
Step 3: Setting Up the Database
The database setup involved:
Creating a database
Creating a dedicated database user
Configuring permissions
Testing database connectivity
I also learned how Prisma migrations work in a production environment.
Step 4: Managing Environment Variables
One of the most important lessons was learning how to manage configuration securely.
Environment variables included:
Database connection strings
Redis configuration
Authentication secrets
API endpoints
Storage settings
Email settings
A small mistake in configuration can stop the entire application from working.
Step 5: Installing Dependencies and Building
After cloning the project:
Install dependencies
Generate Prisma client
Run database migrations
Build frontend and backend applications
This stage taught me that production builds often behave differently from local builds.
Step 6: Running the Backend
I used PM2 to:
Start the backend
Keep it alive after crashes
Restart after server reboots
Store logs
This made the application much more reliable.
Step 7: Configuring DNS
The next step was connecting the domain to the server.
I configured DNS records and waited for propagation.
This taught me patience because sometimes everything is configured correctly and the only thing left is waiting.
Step 8: Learning Nginx
Nginx was one of the most valuable technologies I learned during deployment.
I configured it to:
Serve static files
Reverse proxy API requests
Handle routing
Enable caching
Support uploads
Understanding request flow helped me troubleshoot many issues later.
Step 9: Enabling HTTPS
After the application worked over HTTP, I configured SSL certificates.
This secured:
Website traffic
Authentication requests
API communication
Seeing HTTPS working successfully felt like the final step toward a production-ready system.
Challenges I Faced
Linux Commands
Coming from a frontend background, Linux commands were unfamiliar.
Solution:
Practice and repetition.
Environment Configuration
Incorrect variables caused deployment failures.
Solution:
Double-check every configuration value.
Nginx Configuration
Understanding routing and reverse proxies took time.
Solution:
Test one component at a time.
DNS Delays
Propagation delays created confusion.
Solution:
Verify DNS settings and wait patiently.
SSL Setup
Certificates initially failed because DNS was not fully propagated.
Solution:
Complete DNS setup first, then generate SSL certificates.
My Update Process for Production
Whenever changes are pushed to production:
Take a database backup.
Pull the latest code.
Install updated dependencies.
Run database migrations if needed.
Build the application.
Reload PM2 processes.
Reload Nginx.
Verify critical features.
Check logs for errors.
Following the same process every time reduces deployment mistakes.
What I Learned
This deployment taught me:
Linux administration
VPS management
DNS concepts
Reverse proxy configuration
Database deployment
Redis setup
SSL management
Monitoring
Backup strategies
Production troubleshooting
Most importantly, I learned that deployment is not just about making an application work.
It is about making it secure, reliable, maintainable, and ready for real users.
Final Thoughts
My first VPS deployment was one of the most rewarding experiences of my developer journey.
There were configuration mistakes, deployment failures, and plenty of debugging sessions. But every challenge improved my understanding of how production systems work.
Now I not only know how to build applications, but also how to deploy, manage, update, and maintain them in a production environment.
If this Blog helped or motivated you, feel free to visit my profile Linkedin.com and connect.
Comments
Post a Comment