bolt Valebyte VPS from $4/mo — NVMe, 60s deploy.

Get a VPS arrow_forward
eco Beginner Tutorial/How-to

How to Host Multiple Websites on a Dedicated Server with Nginx

calendar_month May 24, 2026 schedule 4 min read visibility 20 views
How to Host Multiple Websites on a Dedicated Server with Nginx
info

Need a server for this guide? We offer dedicated servers and VPS in 50+ countries with instant setup.

Running multiple websites on a single dedicated server is one of the most efficient ways to utilize powerful bare-metal hardware. By leveraging Nginx server blocks, you can host dozens of high-traffic sites, each with its own domain, security settings, and performance profile, without the overhead of virtualization.

Need a server for this guide?

Deploy a VPS or dedicated server in minutes.

Introduction to Multi-Site Hosting on Bare Metal

When you invest in a Valebyte dedicated server, you are getting raw, unadulterated power. Unlike shared environments or small virtual private servers, a dedicated server provides the CPU cycles, RAM, and NVMe storage required to handle multiple production-grade websites simultaneously. Whether you are a web agency managing client portfolios, a developer running various CI/CD environments, or a business owner hosting several brands, Nginx is the industry-standard web server for the task.

Why Use Nginx for Multiple Websites?

Nginx uses an asynchronous, event-driven architecture that allows it to handle thousands of concurrent connections with minimal memory footprint. On a dedicated server, this means you can scale your web presence horizontally across different domains while maintaining peak performance for every visitor. The secret lies in Server Blocks (similar to Apache's Virtual Hosts), which allow Nginx to direct incoming traffic to the correct directory based on the domain name in the HTTP request header.

Prerequisites and Server Requirements

Before we begin the configuration, ensure your environment meets the following requirements:

  • A Valebyte Dedicated Server: Running a clean installation of a Linux distribution (Ubuntu 22.04 or Debian 12 are recommended).
  • Root or Sudo Access: You must have administrative privileges to install packages and modify system configurations.
  • Domain Names: At least two domain names (e.g., example1.com and example2.com) with their A-records pointed to your server's public IP address.
  • Firewall Access: Ports 80 (HTTP) and 443 (HTTPS) must be open.

Step 1: Installing Nginx on Your Dedicated Server

First, update your package repository and install the Nginx web server. Connect to your server via SSH and run the following commands:

sudo apt update
sudo apt install nginx -y

Once the installation is complete, verify that Nginx is running:

sudo systemctl status nginx

If the service is active, you can navigate to your server's IP address in a web browser to see the default Nginx landing page.

rocket_launch Quick pick

Looking for a server that just works?

Valebyte VPS — NVMe, 24/7 support, deploy in 60 seconds.

View VPS plans arrow_forward

Step 2: Creating the Directory Structure

To keep your websites organized and secure, it is best practice to create a dedicated directory for each domain within the /var/www/ path. This prevents cross-contamination of files and makes backups easier to manage.

sudo mkdir -p /var/www/example1.com/public_html
sudo mkdir -p /var/www/example2.com/public_html

Setting Permissions and Ownership

By default, these directories are owned by the root user. To allow the web server and your deployment tools to interact with the files, change the ownership to your regular user and the group to www-data.

sudo chown -R $USER:www-data /var/www/example1.com/public_html
sudo chown -R $USER:www-data /var/www/example2.com/public_html
sudo chmod -R 755 /var/www

Step 3: Creating Sample Content

To test our configuration, let's create a simple HTML file for each site. This will help us verify that the server blocks are correctly routing traffic.

For the first site:

nano /var/www/example1.com/public_html/index.html

Paste the following content:

<html>
<head><title>Welcome to Example 1</title></head>
<body><h1>Success! Example1.com is working on Valebyte Bare Metal.</h1></body>
</html>

Repeat this process for example2.com, changing the text accordingly.

Step 4: Configuring Nginx Server Blocks

Nginx stores its configuration files in /etc/nginx/sites-available/. We will create a new configuration file for each website.

Configuration for Example1.com

sudo nano /etc/nginx/sites-available/example1.com

Insert the following configuration block:

server {
    listen 80;
    listen [::]:80;

    root /var/www/example1.com/public_html;
    index index.html index.htm;

    server_name example1.com www.example1.com;

    location / {
        try_files $uri $uri/ =404;
    }

    access_log /var/log/nginx/example1.com.access.log;
    error_log /var/log/nginx/example1.com.error.log;
}

Configuration for Example2.com

Create a similar file for the second domain:

sudo nano /etc/nginx/sites-available/example2.com

Change the root, server_name, and log paths to match the second site. This modular approach ensures that if one site experiences high traffic or configuration errors, it remains isolated from the other.

rocket_launch Quick pick

Looking for a server that just works?

Valebyte VPS — NVMe, 24/7 support, deploy in 60 seconds.

View VPS plans arrow_forward

Step 5: Enabling Configurations and Testing

Nginx uses a symbolic link system to determine which sites are active. Link your new files from sites-available to sites-enabled:

sudo ln -s /etc/nginx/sites-available/example1.com /etc/nginx/sites-enabled/
sudo ln -s /etc/nginx/sites-available/example2.com /etc/nginx/sites-enabled/

Before restarting Nginx, always test the configuration for syntax errors:

sudo nginx -t

If you see syntax is ok and test is successful, restart the Nginx service to apply the changes:

sudo systemctl restart nginx

Step 6: Securing Your Websites with SSL (Let's Encrypt)

In the modern web, HTTPS is mandatory for SEO and security. Using Certbot, you can obtain free SSL certificates for all domains hosted on your Valebyte server.

sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d example1.com -d www.example1.com
sudo certbot --nginx -d example2.com -d www.example2.com

Certbot will automatically update your Nginx configuration files to handle SSL termination and redirect all HTTP traffic to HTTPS.

Common Use Cases for Multi-Site Dedicated Servers

Use CaseWhy Use a Dedicated Server?Nginx Benefit
Game Server PortalsHigh CPU clock speeds for game logic.Fast static content delivery for assets.
E-commerce NetworksIsolation of database resources for security.Excellent handling of high-concurrency sales.
SaaS DevelopmentPredictable performance for CI/CD pipelines.Easy reverse proxying to backend microservices.
Streaming MediaDedicated 1Gbps+ unmetered bandwidth.Efficient buffering and data throughput.
rocket_launch Quick pick

Looking for a server that just works?

Valebyte VPS — NVMe, 24/7 support, deploy in 60 seconds.

View VPS plans arrow_forward

Troubleshooting Common Issues

1. 403 Forbidden Error

This usually happens due to incorrect file permissions. Ensure the www-data user has read access to your web directory and execute access to the parent directories.

2. Site Showing Default Nginx Page

Check if the default configuration is overriding your server blocks. You may need to remove the default link: sudo rm /etc/nginx/sites-enabled/default and restart Nginx.

3. DNS Propagation Issues

If your browser cannot find the site, use the dig command to verify that your domain is correctly pointing to your dedicated server's IP address: dig +short example1.com.

Advanced Optimization Tips

Once your sites are live, you can further optimize your Valebyte server by enabling Gzip compression, configuring FastCGI caching for PHP applications, and fine-tuning the worker_processes and worker_connections in /etc/nginx/nginx.conf to match the core count of your dedicated CPU.

check_circle Conclusion

Setting up multiple websites on a Valebyte dedicated server using Nginx is a powerful way to maximize your infrastructure investment. By following this guide, you have created a scalable, secure, and high-performance environment ready for any workload. Ready to take your hosting to the next level? Explore our high-performance bare-metal configurations today.

help Frequently Asked Questions

Was this guide helpful?

Nginx server blocks dedicated server hosting host multiple websites bare metal server configuration Nginx tutorial
support_agent
Valebyte Support
Usually replies within minutes
Hi there!
Send us a message and we'll reply as soon as possible.