1. root
1.1. Directives
Syntax: root path ;Default: root html ;Context: http,server,location,if in location
1.2. Instroduction
Specify root directory,the request file will like as $documentroot/$uri. For example:
Directive setting: **_root /opt/website ; request uri: /images/test.jpg** ; nginx will response: /opt/website/images/test.jpg.
2. alias
2.1. Directives
Syntax: alias path ;Defautl: CloseContext: location
2.2. Instroduction
Defines a replacement for the specified location.For example:
location /i/ {alias /opt/website/;}
on request of “/i/top.gif”,the file “/opt/website/top.gif” will be sent.
If alias is used inside a location defined with a regular expression then such regular expression should contain captures and alias should refer to these captures (0.7.40), for example:
location ~ ^/users/(.+\.(?:gif|jpe?g|png))$ {alias /data/w3/images/$1;}
