You may use the alias directive within a location block, like this:

In the above configuration, the main site is configured with the /var/www/example.com directory. But the URL begins with “/static” will be served with “/var/content/static” directory. For example, A URL http://www.example.com/static/file.txt will point to /var/www/static/file.txt file.


title: “Mapping Url To Different Path In Nginx Tecadmin” ShowToc: true date: “2022-12-22” author: “Henry Peterson”


You may use the alias directive within a location block, like this:

In the above configuration, the main site is configured with the /var/www/example.com directory. But the URL begins with “/static” will be served with “/var/content/static” directory. For example, A URL http://www.example.com/static/file.txt will point to /var/www/static/file.txt file.