Production server:
os:centos6.8
web:nginx-1.10.1
tasks: Configuring nginx Index (directory browsing), beautify the index page.
Installing the Ngx-fancyindex plugin in the case of Nginx installation
[Email protected] tools]# wget http://nginx.org/download/nginx-1.10.1.tar.gz #下载原始nginx版本
Download Nginx Ngx-fancyindex
[Email protected] tools]# wget https://github.com/aperezdc/ngx-fancyindex/archive/master.zip
[Email protected] tools]# Unzip Master.zip
[Email protected] tools]# Tar XF nginx-1.10.1.tar.gz
[Email protected] nginx-1.10.1]#/configure \
--prefix=/application/nginx \
--with-http_stub_status_module \
--with-http_image_filter_module \
--user=nginx \
--group=nginx \
--with-http_ssl_module \
--add-module=. /ngx-fancyindex-master
[[email protected] nginx-1.10.1]# make #到这步即可, make install is not required.
[[email protected] nginx-1.10.1]# CP objs/nginx/application/nginx/sbin #复制重新编译的objs下的nginx文件到sbin/down, covered Nginx
CP: Unable to create normal file "/application/nginx/sbin/nginx": Text file busy
The reason is that the Nginx service is running, you can use the following methods to stop the Nginx service, and then copy nginx overwrite
Close Nginx:
#nginx-S stop: fast stop Nginx
Quit: Complete and orderly stop nginx
#service Nginx Stop
Other ways to stop Nginx:
#ps-ef | grep nginx
Kill-quit main process number: calmly stop Nginx
Kill-term main process number: fast Stop Nginx
Pkill-9 Nginx: Forced stop Nginx
[email protected] nginx-1.10.1]# pkill-9 nginx #最好不要用这种方式, it is possible that the Nginx service could not be started
[2] has killed/application/nginx/sbin/nginx
[3] has killed/application/nginx/sbin/nginx
[4]-has killed/application/nginx/sbin/nginx
[5]+ has killed/application/nginx/sbin/nginx
[email protected] nginx-1.10.1]# CP objs/nginx/application/nginx/sbin/
[Email protected] conf]#. /sbin/nginx-t
Nginx:the configuration file/application/nginx/conf/nginx.conf syntax is OK
Nginx:configuration file/application/nginx/conf/nginx.conf Test is successful
[Email protected] conf]#. /sbin/nginx-s Reload
[Email protected] conf]# VI nginx
Location/{
root/application/html/
Fancyindex on; #开启索引
Fancyindex_exact_size off; #显示文件大小
Fancyindex_localtime on; #使用本地时间
Fancyindex_footer footer.html; #把当前路径下的footer. HTML content as the bottom
Fancyindex_header header.html; #把当前路径下的header. HTML content as top
Fancyindex_ignore footer.html header.html;
}
The results are as follows:
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/8C/1F/wKioL1hjKmCiZhxGAAI3ih3-FaI195.jpg-wh_500x0-wm_3 -wmp_4-s_2720546864.jpg "title=" is not named. JPG "width=" "height=" 411 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:600px;height:411px; "alt=" Wkiol1hjkmcizhxgaai3ih3-fai195.jpg-wh_50 "/>
Installing the Configuration Ngx-fancyindex plugin