The main file we need to edit is the nginx.conf file. The other files are included inside the nginx.conf file depending on what configuration options you want to use. If you open the file, you will see the default configuration has a lot of comments and examples of virtual hosts.
Let’s simplify the file and create a directory to store our virtual hosts in.
1. Delete the nginx.conf file (we can restore it by copying nginx.conf-dist or use it as a reference to see the default configuration).
2. Create a new nginx.conf file.
Add the following configuration to the file.
You will notice, there are no server blocks in this file. Instead, we have used an include that searches the sites directory for more conf file. This is where we will put our conf files for each website we want to host.
3. Create a directory called sites to store our virtual host configuration files.
4. Create a file called default.conf to store the default website configuration.