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)06/02 Report--
In this issue, the editor will bring you about how to build a Nginx static file server and how to analyze the autoindex module. The article is rich in content and analyzes and describes for you from a professional point of view. I hope you can get something after reading this article.
The ngx_http_autoindex_module module processes requests that end with a slash character ('/') and generates a list of directories. When the ngx_http_index_module module cannot find the index.html file, it usually passes the request to the ngx_http_autoindex_module module. Ngx_http_autoindex_module
Sample configuration:
Location / {root / home/map/www/; # specify the path where the directory is located autoindex on; # turn on the directory browsing function autoindex_exact_size off;# displays the file size in a readable manner, in KB, MB or GB,autoindex_format format valid autoindex_localtime on; # takes the server's file time as the display time, and valid when autoindex_format is in html format # autoindex_format html # display the contents of the directory in the style of a web page. This attribute is applicable to charset utf-8,gbk; # display Chinese file name} at or above 1.7.9.
Autoindex
Turn on or off the function of listing files in a directory
Syntax: autoindex on | off;Default: autoindex off;Context: http, server, location
Autoindex_exact_size
For HTML format, specify whether the exact file size should be output in the directory list or rounded to kilobytes, megabytes, and gigabytes
Syntax: autoindex_exact_size on | off;Default: autoindex_exact_size on;Context: http, server, location
Autoindex_localtime
For HTML format, specify whether the time in the directory list should be output in the local time zone or UTC.
Syntax: autoindex_localtime on | off;Default: autoindex_localtime off;Context: http, server, location
Autoindex_format
Format the directory list.
When using the JSONP format, use the callback request parameter to set the name of the callback function. If the parameter is missing or has a null value, the JSON format is used. The XML output can be converted using the ngx_http_xslt_module module. Syntax: autoindex_format html | xml | json | jsonp;Default: autoindex_format html;Context: http, server, locationThis directive appeared in version 1.7.9.
Nginx Fancy Index module
In the actual experience, the interface shown by the ngx_http_autoindex_module module is a bit ugly, so we can use the third Nginx Fancy Index module module, which provides dynamic loading and can also be compiled, which is installed here to replace the original nginx binaries.
If the module is loaded dynamically, you need to add it to the events block:
Load_module "modules/ngx_http_fancyindex_module.so"
# View the original nginx compilation module [root@localhost sbin] #. / nginx-Vnginx version: nginx/1.14.2built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) configure arguments:-- prefix=/usr/local/nginx download Nginx Fancy Index module source code package: https://github.com/aperezdc/ngx-fancyindex/archive/v0.4.4.tar.gz# compilation. / configure-- prefix=/usr/local/ Nginx--add-module=/root/nginx-src/ngx-fancyindex-0.4.4make# cannot make insatll backup the original nginx binaries Replace with the newly generated binary file, add some content to nginx.conf, and fancyindex will be enabled.
Edit nginx.conf
Location / {# include / usr/local/nginx/html/Nginx-Fancyindex-Theme/fancyindex.conf;root django-document/;#autoindex on;#autoindex_exact_size off;fancyindex on;# enable nginx directory browsing function fancyindex_exact_size off; # File size is displayed from KB fancyindex_localtime on;# shows that the file modification time is the server local time # set $limit_rate 1kscape root html;#index index.html index.htm;}
The theme is still a little ugly at this time. You can download the theme package git clone https://github.com/lanffy/Nginx-Fancyindex-Theme.git.
Copy the Nginx-Fancyindex-Theme file to the root folder, introduce the theme package into nginx.conf, and beautify it.
Location / {include / usr/local/nginx/html/Nginx-Fancyindex-Theme/fancyindex.conf;root django-document/;autoindex on;autoindex_exact_size off;} the above is how to build a Nginx static file server and how to parse the autoindex module. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are 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.