Alias or root directive

Francis Daly francis at daoine.org
Thu Nov 3 18:25:27 UTC 2016


On Thu, Nov 03, 2016 at 06:51:43PM +0100, Daniel wrote:

Hi there,

> > What one example http request do you want to make?
> 
> I wanted to load such kind of URL:
> domain.de//en/holidays/shared/images/guides/germany/berlin.jpg
> 
> > What file on your filesystem do you want nginx to serve in response to
> > that request?
> 
> on /mnt/nfs/uat/ are the folders like guides/germany/

"alias" replaces the bit in the location with the bit in the alias,
and uses the result as the filename to serve. So try:

    location ^~ /en/holidays/shared/images/ {
      alias /mnt/nfs/uat/;
    }

Note - it is "^~" so that *everything* below /en/holidays/shared/images/
will be served from the filesystem. (That is not a regex pattern.)

Also, the number of / at the end of the location and the alias are the same.

If you check your error_log, you should see an indication of what file
nginx tried to serve, if it failed.

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list