Nginx Server Block Checklist for Multiple Websites

halfbrain_logo512adminJune 12, 2026
1 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.

Estimated Time

30–60 minutes

Use Case

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


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
See also  n8n VPS Deployment Checklist

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 *