Advertisement
linuxserver Deploying a website on a Linux server might sound intimidating—especially if you're a complete beginner—but it’s actually a very manageable process once you break it down into clear, simple steps. In this tutorial, we’ll walk through how to deploy a basic HTML website using Nginx on a Linux server.

How to Deploy a Simple Website on a Linux Server Using Nginx (Beginner-Friendly Guide)

5 Min Read Verified Content
This guide is written in a friendly, relaxed tone that even total newbies or “dummy-level” learners can follow. By the end, you’ll know how to install Nginx, upload your files, configure your server, and see your website live on the internet.

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:

ssh root@YOUR_SERVER_IP

Press Enter → type your password → welcome to your server!




3. Update Your System (A Safe First Step)

Before installing anything, update your server packages:

sudo apt update sudo apt upgrade -y

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:

sudo apt install nginx -y

When the installation finishes, check if it's running:

systemctl status nginx

If you see active (running) — congrats, Nginx is alive.

You can also test by visiting:

http://YOUR_SERVER_IP

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:

/var/www/html/

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:

sudo chown -R www-data:www-data /var/www/html sudo chmod -R 755 /var/www/html

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:

sudo nano /etc/nginx/sites-available/default

Look for this block:

root /var/www/html; index index.html;

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:

sudo systemctl restart nginx


8. Visit Your Website — It Should Be Live Now

Open a browser and type:

http://YOUR_SERVER_IP

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:

sudo ufw enable

Allow Nginx:

sudo ufw allow 'Nginx Full'

Check the firewall:

sudo ufw status

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.



Advertisement
Back to Linuxserver