How to Deploy a Simple Website on a Linux Server Using Nginx (Beginner-Friendly Guide)
1. What You Need Before We Start
Let’s keep it simple. You need only three things:
-
A Linux server (Ubuntu is easiest for beginners)
-
SSH access (your hosting provider gives this)
-
A simple website folder (even just
index.html)
If you have these ready, you're good to go.
2. Connect to Your Linux Server
You can’t deploy anything if you can't enter the server.
Windows Users
Install PuTTY → open it → enter your server IP → click Open.
Mac & Linux Users
You already have Terminal. Just type:
Press Enter → type your password → welcome to your server!
3. Update Your System (A Safe First Step)
Before installing anything, update your server packages:
This ensures everything is fresh and less buggy.
4. Install Nginx (Your Web Server)
Nginx is the software that will show your website to visitors.
Install it with:
When the installation finishes, check if it's running:
If you see active (running) — congrats, Nginx is alive.
You can also test by visiting:
You should see the Nginx welcome page.
That means your server is ready to host your website.
5. Upload Your Website Files
There are several ways to upload your website, but let’s use the beginner-friendly one:
Method 1 — Using SFTP (Recommended for Newbies)
Download FileZilla → connect using:
-
Host:
sftp://YOUR_SERVER_IP -
Username:
root(or your user) -
Password: your SSH password
-
Port: 22
Navigate to:
Delete everything inside it.
Then upload your website files:
index.html, CSS folder, image folder, etc.
Whatever you put here will be displayed on the website.
6. Adjust Permissions (So Your Website Loads Properly)
Run this command:
This makes sure Nginx can read your files.
7. Configure Nginx to Serve Your Website
Let’s make sure your Nginx knows which folder to use.
Open the default configuration file:
Look for this block:
If it matches your file structure, you're good.
If your main file is named something else (like home.html), rename it to index.html.
Search engines and browsers expect this.
Save the file:
CTRL + O → Enter → CTRL + X
Restart Nginx so your changes take effect:
8. Visit Your Website — It Should Be Live Now
Open a browser and type:
If you uploaded an index.html file, you should see your website appear instantly.
Congratulations — you just deployed your first website on a Linux server.
9. Optional but Highly Recommended: Enable Firewall
Let’s keep the server safe.
Enable firewall:
Allow Nginx:
Check the firewall:
Nice and secure.
10. Optional: Point Your Domain to the Server
If you have a domain, you can point it to your server by:
-
Going to your domain DNS manager
-
Adding an A record
-
Name:
@ -
Value: YOUR_SERVER_IP
-
Wait 5–15 minutes for DNS to update.
Then visit your domain and your site should load.
11. Troubleshooting (For Newbies)
❌ Website not showing?
✔ Check Nginx status
✔ Check your index.html exists
✔ Restart Nginx
✔ Check permissions
❌ Getting 403 Forbidden?
✔ The folder permissions are wrong
✔ Run the chmod and chown commands again
❌ Getting 404 Not Found?
✔ Your file is not named index.html
✔ Wrong folder path
❌ DNS not working?
✔ Wait for propagation
✔ Check DNS type (should be A record)
✔ Remove old AAAA (IPv6) entries if unused
Conclusion
Deploying a website on a Linux server using Nginx is much easier than most beginners expect. By following these simple steps—connecting via SSH, installing Nginx, uploading your files, configuring the server—you now know how to bring a website online from scratch. This is an essential skill for anyone learning web development, server management, or wanting to host their own projects.
You’re now officially capable of deploying websites like a real developer.