Last updated on

Nginx server blocks allow you to run multiple websites on a single server. Using this server block, you can specify the website document root, different SSL certificates for different sites, different security policies for different sites and reverse proxy configuration, and much more. Here the tutorial we explain the step by step instruction about how to set up Nginx server blocks on Ubuntu.

Prerequisites

Before going to follow this tutorial you need to install Nginx and make sure it was running properly. Next, point your domains to your server and also make sure you have a non-root user account with sudo privileges

Create and set up domain root directories

Domain root directories where the website files stored and served by the server. We will use the following directory structure: