Context: location. Variables are accepted.
alias is a directive that you place in a location block only. It assigns a different path for Nginx to retrieve documents for a specific request. As an example, consider the following configuration:
http { server { server_name localhost; root /var/www/website.com/html; location /admin/ { alias /var/www/locked/; } } }
When a request for http://localhost/ is received, files are served from the /var/www/website.com/html/ folder. However, if Nginx receives a request for http://localhost/admin/, the path used to retrieve the files is /home/website.com/locked/. Moreover, the value of the document root directive (root) is not altered. This procedure is invisible in the eyes of dynamic scripts.
Syntax: Directory (do not forget the trailing /) or file path