宝塔Nginx-Fancyindex-Theme样式

作者:特约编辑    类别:Windows     日期:2021-05-05 14:10:19    阅读:10次    消耗积分:0

1.Nginx文件备份

cd /www/server/nginx/sbin/
cp nginx nginx.bak

2.下载Nginx fancyindex模块

cd /root/
git clone https://github.com/aperezdc/ngx-fancyindex
cp -R ./ngx-fancyindex /www/server/nginx/src

3.查看当前Nginx编译模块

nginx  -V

4.编译Nginx

cd /www/server/nginx/src
./configure --user=www --group=www --prefix=/www/server/nginx \
--add-module=/www/server/nginx/src/ngx_devel_kit \
--add-module=/www/server/nginx/src/lua_nginx_module \
--add-module=/www/server/nginx/src/ngx_cache_purge \
--add-module=/www/server/nginx/src/nginx-sticky-module \
--with-openssl=/www/server/nginx/src/openssl \
--with-pcre=pcre-8.43 \
--with-http_v2_module \
--with-stream \
--with-stream_ssl_module \
--with-stream_ssl_preread_module \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-http_image_filter_module \
--with-http_gzip_static_module \
--with-http_gunzip_module \
--with-ipv6 \
--with-http_sub_module \
--with-http_flv_module \
--with-http_addition_module \
--with-http_realip_module \
--with-http_mp4_module \
--with-ld-opt=-Wl,-E \
--with-cc-opt=-Wno-error \
--with-ld-opt=-ljemalloc \
--with-http_dav_module \
--add-module=/www/server/nginx/src/nginx-dav-ext-module \
--add-module=/www/server/nginx/src/ngx-fancyindex
make

5.替换Nginx文件

nginx -s quit
cp objs/nginx /www/server/nginx/sbin/
nginx

6.下载Nginx-Fancyindex-Theme主题

wget https://codeload.github.com/Naereen/Nginx-Fancyindex-Theme/zip/master
unzip master
cd Nginx-Fancyindex-Theme-master
cp -rp Nginx-Fancyindex-Theme-light/ /www/wwwroot/test_dir/

7.在宝塔网站配置添加

location /files {
if ($request_filename ~* ^.*?\.(txt|doc|pdf|rar|gz|zip|docx|exe|xlsx|ppt|pptx)$){
add_header Content-Disposition attachment;
}
alias /data/download; 
fancyindex on;
fancyindex_exact_size off;
fancyindex_localtime on;
fancyindex_header "/Nginx-Fancyindex-Theme-light/header.html";
fancyindex_footer "/Nginx-Fancyindex-Theme-light/footer.html";
fancyindex_ignore "examplefile.html";
fancyindex_ignore "Nginx-Fancyindex-Theme-light";
fancyindex_name_length 255;
}

8.重启Nginx

nginx -s reload

你可能也喜欢————

图片加载中...

Linux安装部署SVN

更新时间:2021-04-06 12:45:11


图片加载中...

WordPress优化

更新时间:2021-05-12 23:26:03


图片加载中...

Windows安装Linux子系统

更新时间:2021-04-17 20:28:59


图片加载中...

修改ssh默认端口

更新时间:2021-04-13 18:27:59


图片加载中...

Linux回收站

更新时间:2021-04-10 23:43:48


图片加载中...

htpasswd命令

更新时间:2021-04-06 03:24:08


图片加载中...

Ubuntu安装google-chrome

更新时间:2021-05-10 07:04:04


图片加载中...

服务器压力测试

更新时间:2021-04-28 19:03:31


图片加载中...

WSL挂载移动硬盘或U盘

更新时间:2021-04-24 10:12:30


有0条评论——


暂无评论!


发表评论——

提示:登录后才能发表评论,并且享受积分哦!