With "alias" you can set alias to another file name, like
location /users.txt {
alias /home/www/static-files/filename.txt;
}
whereas
location /users.txt {
root /home/www/static-files/;
}
forces you to name your file as robots.txt
in others words.
when you use root, location added to to the root
ex :
location /users.txt {
root /home/www/static-files;
}
result : /home/www/static-files/users.txt
when you use alias, location added to to the alias
ex:
location /users.txt {
alias /home/www/static-files/users.txt;
}
result : /home/www/static-files/users.txt
Hope you find it helpful.
More From Oodles
Ready to innovate? Let's get in touch
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Ravi Verma
Ravi is a seasoned technologist with excellent experience in AngularJS , NodeJS and MEAN stack. He has good experience in developing complex UIs for web and mobile applications.