Nginx Server Block Checklist for Multiple Websites

halfbrain_logo512adminJune 12, 2026
176 lượt xem

Nginx Server Block Checklist for Multiple Websites

When you host multiple websites on one VPS, Nginx server blocks decide which domain points to which website directory. A small mistake in server_name, root path or SSL config can cause wrong website loading, 404 errors or redirect problems.

What this checklist covers

  • Domain mapping
  • Server block file
  • Root directory
  • Index file
  • SSL config
  • Redirect rules
  • Config testing

Checklist

  1. Create a separate website directory for each domain.
  2. Create a separate Nginx server block file for each domain.
  3. Set the correct server_name.
  4. Set the correct root path.
  5. Set index files correctly.
  6. Enable the site using a symlink if using sites-available and sites-enabled.
  7. Run nginx -t before reload.
  8. Install SSL for the correct domain.
  9. Check www and non-www behavior.
  10. Test each domain separately in browser.

Final check

Each domain should load its own website, use the correct SSL certificate and redirect consistently to the final preferred URL.

Checklist Type Technical Setup
Level Intermediate
Risk Level Medium Risk
Estimated Time 30–60 minutes

When to Use This Checklist

Use this checklist when adding a new domain or hosting multiple websites on the same Nginx VPS.

Required Tools

SSH access, Nginx, domain DNS access, website root path, Certbot, text editor

Before You Start

Prepare the domain, website directory and preferred URL format before editing Nginx config.

Structured Checklist Steps

  1. Create website directory.
  2. Create server block file.
  3. Set server_name.
  4. Set root path.
  5. Set index directive.
  6. Enable site symlink.
  7. Run nginx -t.
  8. Reload Nginx.
  9. Install SSL.
  10. Test domain and redirects.

Rollback Plan

If a new server block breaks Nginx, remove the symlink from sites-enabled or restore the previous config file, then test and reload Nginx.

Common Mistakes

  • Wrong root path.
  • Missing server_name.
  • Forgetting to enable the site.
  • Reloading Nginx before nginx -t.
  • Mixing SSL configs between domains.

Related Commands

sudo nano /etc/nginx/sites-available/example.com
sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
sudo certbot --nginx -d example.com -d www.example.com

Share:

Disclaimer: The guides, checklists, commands, and examples on HalfBrain.net are provided for educational and operational reference only. Server environments, hosting providers, software versions, security settings, and WordPress configurations can vary, so you should always review commands before running them on your own system. We do our best to keep the content accurate and useful, but we cannot guarantee that every command, configuration, or recommendation will fit every environment. Always back up your website, database, and server configuration before making changes. HalfBrain.net is not responsible for data loss, downtime, security incidents, misconfiguration, or other issues that may result from applying the information on this website. Use the material at your own discretion.

Leave a Reply

Your email address will not be published. Required fields are marked *