Nginx - alias and try_files redirection in location block

nginx.conf snippet:

location /logo/general/ {

    autoindex_localtime on;

    alias /opt/config/;

    try_files /logo/logo.png /www/html/logo.png =404;

}

Meaning: When accessing the /logo/general/ address,

For example: when visiting http://127.0.0.1/logo/general/logo.png,

In the location block, alias is used to redirect the directory to /opt/congig.

Then the try_files keyword tries to find /opt/config/logo/logo.png and returns it. If it does not exist, it returns /opt/config/www/html/logo.png. If it does not exist, it returns 404.

Guess you like

Origin blog.csdn.net/xuezhangjun0121/article/details/135411062