Table of Contents
Nginx is a web server that can also be used as a reverse proxy, load balancer, mail proxy and HTTP cache. The software was created by Igor Sysoev and publicly released in 2004. Nginx is free and open-source software, released under the terms of the 2-clause BSD license.
How to map a sub URL to a different directory path in the file system. The Nginx users can achieve this by using the “location” block in the configuration file. The location specifies a regular expression for the URL the browser requests. Under the location code block, we can specify the file system path with the ‘root’ or ‘alias’ option.
How to Map URL to Different Path In Nginx
You may use the alias directive within a location block, like this:
server { server_name www.site.com; root /var/www/site.com; location /static/ { alias /var/content/static/; } }
In the above configuration, the main site is configured with the /var/www/site.com
directory. But the URL begins with “/static” will be served with “/var/content/static” directory. For example, A URL http://www.site.com/static/file.txt will point to /var/www/static/file.txt file.
Latest Posts

Oppo Reno8 T

How To Install QElectroTech on Ubuntu 20.04 | 22.04 LTS

Extracting Embedded Images from PDF: A Step-by-Step Guide

10 Best Free and Open Source Video Editing Software

How to Set Up NFS Share on Debian
Trending Posts

How To Install Chrony (NTP) On CentOS 8, 7 & RHEL 8, 7

TAR Command and Examples

How To Install Google Chrome On macOS

How to Upgrade Windows 10 to Windows 11
