In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
In this article Xiaobian introduces in detail the "root&alias file path and index directory configuration in Nginx" with detailed contents, clear steps and proper handling of details. I hope that this article "root&alias file path and index directory configuration in Nginx" can help you solve your doubts.
Root&alias file path configuration
Nginx specifies the file path in two ways: root and alias, the usage of which is different, and the usage is summarized to facilitate quick response in the application process. The main difference between root and alias is how nginx interprets the uri after location, which causes the two to map requests to server files in different ways.
[root]
Syntax: root path
Default value: root html
Configuration segment: http, server, location, if
[alias]
Syntax: alias path
Configuration segment: location
Example:
Location ~ ^ / weblogs/ {root / data/weblogs/www.jb51.net; autoindex on; auth_basic "restricted"; auth_basic_user_file passwd/weblogs;}
If a requested uri is / weblogs/httplogs/www.jb51.net-access.log, the web server will return the file of / data/weblogs/www.jb51.net/weblogs/httplogs/www.jb51.net-access.log on the server.
Root will map based on the full uri request, that is, / path/uri. [
Therefore, the previous request is mapped to path/weblogs/httplogs/www.jb51.net-access.log.
Location ^ / binapp/ {limit_conn limit 4; limit_rate 200k; internal; alias / data/statics/bin/apps/;}
Alias discards the path configured after location and points the currently matched directory to the specified directory. If a requested uri is / binapp/a.jb51.net/favicon, the web server will return the file of / data/statics/bin/apps/a.jb51.net/favicon.jgp on the server.
1. When using alias, be sure to add "/" to the directory name.
2. Alias can specify any name.
3. When using regular matching, alias must capture the content to match and use it at the specified content.
4. Alias can only be in a location block.
Index directory configuration
For easy file sharing, some people use svn, some people use ftp, but more people use the index feature. The index function of apache is powerful, and it is also the most common. The directory index of nginx auto_index is too few, and the function is very simple. Let's take a look at our effect picture first.
Nginx configuration
Location ~ ^ / 2589 (/. *) {autoindex on; / / enable autoindex_localtime on / / enable display function} read here, this article "how to configure the root&alias file path and index directory in Nginx" has been introduced. If you want to master the knowledge points of this article, you still need to practice and use it before you can understand it. If you want to know more about related articles, welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.