See how our Nginx Support team guides you step-by-step to run multiple websites on one Nginx server for a clean and reliable hosting setup.

Simple Setup for Multiple Sites on Nginx

Managing each website on a separate server can take more time and money than you expect. Many people choose Nginx because it lets them run multiple sites on one server without losing speed or control. It cuts costs, reduces work, and keeps everything organized. If you want a simple and reliable way to handle more than one website, this guide shows how to set up multiple sites on a single Nginx server.

Why host multiple websites on one Nginx server

Simple Setup for Multiple Sites on Nginx

  • Saves hosting costs since you avoid extra servers
  • Reduces maintenance because you manage everything in one place
  • Uses CPU, memory, and storage more wisely
  • Directs each domain to the correct site without confusion
  • Keeps updates and security changes simple
  • Let’s you set up staging sites for testing
  • Keeps SSL certificate management organized

What to check before you do it

  • Make sure the server has enough resources
  • Keep each site secure
  • Watch traffic patterns because a busy site might need its own server

Want help managing your Nginx server?

Chat animation


Simple Steps to Run Multiple Domains on Nginx

1: Install Nginx
  • Use your system package manager to install Nginx.
  • Ubuntu or Debian
    sudo apt update
    sudo apt install nginx
  • CentOS or Fedora
    sudo yum install nginx

Nginx starts after installation, so your server should already be active.

2: Check if Nginx is Running
  • Confirm the service status.
    sudo systemctl status nginx
  • Start the service if needed.
    sudo systemctl start nginx
  • Restart it when you make changes.
    sudo systemctl restart nginx
  • Open your server IP in a browser to see the Nginx welcome page.
3: Create Folders for Each Website

Create a separate folder for every domain.

mkdir -p /usr/share/nginx/site1.xyz/html
mkdir -p /usr/share/nginx/site2.xyz/html

These folders hold your site files.

4: Add Basic Website Files
  • Create an index.html page inside each HTML folder.
  • Add simple content so you can confirm that the setup works.
5: Create Config Files for Each Website
  • Move to the Nginx conf.d directory.
    cd /etc/nginx/conf.d
  • Create a config file for each domain.
Example
server {
listen 80
server_name site1.xyz
location slash {
root /usr/share/nginx/site1.xyz/html
index index.html
}
}
  • Repeat this for the second site with its own details.
  • Open the main configuration file if needed.
    sudo vi /etc/nginx/nginx.conf
6: Restart Nginx
  • Test your configuration.
    su
    do nginx -t
  • Restart the service.
    sudo systemctl restart nginx
7: Test in Browser
  • Go to each domain, such as site1.xyz and site2.xyz.
  • You should see the correct index page for each site.
8: Update DNS
  • Add an A record for each domain.
  • Point them to your server IP.

[Need assistance with a different issue? Our team is available 24/7.]

Conclusion 

Running multiple sites on one Nginx server gives you a cleaner setup without losing control or speed. If you want a clear guide to get started, step-by-step, shape multiple websites on one Nginx server covers everything you need.

Reach out anytime if you want help with your setup or next steps.