Deploying your first website on a VPS (Virtual Private Server) might sound technical, but once you understand the process, it becomes a powerful and flexible way to host your projects. Unlike shared hosting, a VPS gives you full control, better performance, and scalability—making it ideal for developers, startups, and growing websites.
In this complete guide, you’ll learn how to deploy your first website on a VPS using a clean, production-ready approach.
What is a VPS and Why Should You Use It?
A VPS (Virtual Private Server) is a virtual machine that runs its own operating system and behaves like a dedicated server. It gives you:
- Full root access
- Better performance than shared hosting
- Custom server configuration
- Scalability as your traffic grows
If you’re serious about web development or want more control, VPS hosting is the way to go.
Prerequisites Before You Start
Before deploying your website, make sure you have:
- A VPS from a provider (like DigitalOcean, AWS, or Linode)
- A domain name (optional but recommended)
- Basic knowledge of terminal/command line
- An SSH client (Terminal for macOS/Linux or PuTTY for Windows)
Step 1: Connect to Your VPS via SSH
Once your VPS is ready, connect to it using SSH:
ssh root@your_server_ip
Replace your_server_ip with your actual VPS IP address.
Step 2: Update Your Server
Keeping your system updated ensures security and stability:
apt update && apt upgrade -y
Step 3: Create a New User (Security Best Practice)
Avoid using the root user for everyday tasks:
adduser deploy
usermod -aG sudo deploy
Switch to your new user:
su - deploy
Step 4: Install a Web Server (Nginx)
Nginx is fast, lightweight, and widely used:
sudo apt install nginx -y
Check if it’s running:
systemctl status nginx
Now visit your server IP in a browser:
http://your_server_ip
You should see the default Nginx welcome page.
Step 5: Upload Your Website Files
There are multiple ways to upload your website:
Option 1: Using SCP
scp -r ./your-website deploy@your_server_ip:/var/www/html
Option 2: Using Git
sudo apt install git -y
cd /var/www
sudo git clone https://github.com/your-repo.git html
Option 3: Using SFTP Tools
Use tools like FileZilla or WinSCP to upload files to:
/var/www/html
Step 6: Configure Nginx for Your Website
Create a new configuration file:
sudo nano /etc/nginx/sites-available/mywebsite
Add the following configuration:
server {
listen 80;
server_name your_domain_or_ip; root /var/www/html;
index index.html; location / {
try_files $uri $uri/ =404;
}
}
Enable the site:
sudo ln -s /etc/nginx/sites-available/mywebsite /etc/nginx/sites-enabled/
Test and restart Nginx:
sudo nginx -t
sudo systemctl restart nginx
Step 7: Connect Your Domain to VPS
To use a domain:
- Go to your domain registrar (e.g., GoDaddy, Namecheap)
- Add an A Record:
- Host:
@ - Value: Your VPS IP
- Host:
DNS propagation may take a few hours.
Step 8: Secure Your Server with a Firewall
Enable firewall protection:
sudo ufw allow OpenSSH
sudo ufw allow 'Nginx Full'
sudo ufw enable
Check status:
sudo ufw status
Step 9: Enable HTTPS with Free SSL (Let’s Encrypt)
Install Certbot:
sudo apt install certbot python3-certbot-nginx -y
Run the setup:
sudo certbot --nginx
Follow the prompts to enable HTTPS.
Step 10: Test Your Live Website
Once everything is configured, visit:
http://your_server_ip- OR
https://yourdomain.com
Your website should now be live and secure.
Common Mistakes to Avoid
- Uploading files to the wrong directory
- Forgetting to restart Nginx after changes
- Not opening firewall ports
- DNS not properly configured
- Incorrect file permissions
Pro Tips for Better Deployment
- Use Git for version control and easy updates
- Automate deployments with CI/CD (GitHub Actions)
- Use Docker for containerized apps
- Monitor your server (CPU, RAM, logs)
- Regularly update your system
Conclusion
Deploying your first website on a VPS might feel challenging at first, but it’s a valuable skill that gives you full control over your hosting environment. By following this guide, you now have a solid foundation to host and manage your own websites.
As you grow, you can explore advanced setups like hosting multiple sites, using reverse proxies, or deploying full-stack applications.
FAQs
Is VPS better than shared hosting?
Yes, VPS offers better performance, control, and scalability compared to shared hosting.
Do I need coding skills?
Basic command-line knowledge is helpful, but you don’t need advanced coding skills.
Can I host multiple websites on one VPS?
Yes, you can configure multiple server blocks in Nginx.

