Introduction
The root directive in nginx tells the server where to find the files it should serve to users. It solves the problem of linking web addresses to actual files on the server.
When you want to serve static files like HTML, CSS, or images from a specific folder on your server.
When you need to set the main folder for your website content so nginx knows where to look.
When you want to host multiple websites on one server and each site has its own folder.
When you want to change the folder nginx uses without moving files around.
When you want to test a new version of your website by pointing nginx to a different folder.