Fancyindex+Nginx,打造自己的简约下载站

༺小ʚɞ寞༻ Wiki评论27,8404字数 2839阅读9分27秒阅读模式

近期折腾了一个下载站,用来方便大家和自己,存储一些东西,地址:http://yun.lucktang.com/

关于Fancyindex模块美化Nginx的Index的功能已经到处都是了,百度上一下就行,简单总结下安装教程。

  • 1.准备一个纯净的Linux环境,编译nginx,不会的话直接安装LNMP就行,
  • 推荐:军哥一键包 下载地址 :http://lnmp.org/download.html
  • 2.安装Fancyindex模块。
  1. wget http://nginx.org/download/nginx-1.9.13.tar.gz
  2. tar -xzvf nginx-1.9.13.tar.gz
  3. git clone https://github.com/aperezdc/ngx-fancyindex.git ngx-fancyindex
  4. nginx -V //得到Nginx的参数,全部复制
  5. cd nginx-1.9.13
  6. ./configure --add-module=../ngx-fancyindex 你刚才复制的参数
  7. make
  8. make install
  • 3.LNMP新建一个主机,不需要数据库,和普通开通虚拟主机一样的步骤。
    4.修改conf文件。
  1. server {
  2. listen       80;
  3. server_name  down.lucktang.com;
  4. index index.html index.php index.html;
  5. root /data/wwwroot/down.lucktang.com;
  6. fancyindex on;
  7. fancyindex_exact_size off;
  8. fancyindex_localtime on;
  9. fancyindex_footer /footer.html;
  10. fancyindex_header /header.html;
  11. fancyindex_ignore footer.html header.html;
  12. }
  • 完成后重启Nginx service nginx reload
  • 5.提供一份页面头部和底部的美化模板,完成后放在网站的根目录下。
  • (1)新建一个header.html
  1. <html xmlns="http://www.w3.org/1999/xhtml">
  2. <head><meta http-equiv="content-type" content="text/html; charset=utf-8"/>
  3. <style type="text/css" media="screen">
  4. body,html {background:#fff;font-family: "Lucida Grande",Calibri,Arial;font-size: 13pt;color: #333;background: #f8f8f8;}
  5. tr.e {background:#f4f4f4;}
  6. th,td {padding:0.1em 0.5em;}
  7. th {text-align:left;font-weight:bold;background:#eee;border-bottom:1px solid #aaa;}
  8. #top1 {width:80%; font-size:28px; margin: 0 auto 5px auto;}
  9. #top2 {width:80%; font-size:18px; margin: 0 auto 5px auto;}
  10. #footer {width:80%;margin: 0 auto; padding: 10pt 0;font-size: 10pt;text-align:center;}
  11. #footer a {font-size: 14px; font-weight: normal; text-decoration: underline;}
  12. #list {border:1px solid #aaa;width:80%;margin: 0 auto;padding: 0;}
  13. a {color: #b00;font-size: 11pt;font-weight: bold;text-decoration: none;}
  14. a:hover {color: #000;}
  15. #readme {padding:0;margin:1em 0;border:none;width:100%;}
  16. </style>
  17. <script type="text/javascript">// <!CDATAfunction ngx_onload(){var f=document.getElementById('readme');if(!(f&&f.contentDocument))return;f.style.height=f.contentDocument.body.offsetHeight+'px';f.contentDocument.body.style.padding='0';f.contentDocument.body.style.margin='0';}// ]]></script>
  18. <title>LuckTang下载站</title>
  19. </head>
  20. <body onload="ngx_onload()">
  21. <h1 id="top1">文件目录列表</h1>
  22. <h1 id="top2">Directory listing of
  • (2)新建一个footer.html
  1. <!-- footer START -->
  2. <div id="footer">
  3. <div id="themeinfo">
  4.  <a href="http://www.lucktang.com/1502.html" target="_blank" title="LuckTang Download Center">想拥有这样的一个下载站?</a> | <a href="http://www.Lucktang.com" target="_blank">LuckTang博客</a>  | <a href="http://www.lucktang.com/linux/" target="_blank">Linux学习笔记</a> | <a href="http://www.116ss.com" target="_blank">免费SS</a>
  5.  </div>
  6. <div id="copyright">
  7. 本站所有资源均来源于互联网络,仅供学习参考之用,不得用于商业用途 2015-2016 Powered by LuckTang
  8. 由于服务器在国外,即使对其进行了网络优化仍存在不稳定的因素,较大的文件建议使用迅雷等离线下载的方式先下载到离线下载服务器,再自行下载到本地以节约下载时间,中国大陆地区以外的服务器之间传输一般不受影响</div>
  9. </div>
  10. <!-- footer END -->
  • html文件请根据自己的需要修改即可。

历史上的今天
5月
18
weinxin
LuckTang's Blog 站长语录
LuckTang's Blog,欢迎各位来访!这是我的QQ,扫一扫,加好友。大家一起交流博客建站技术,分享前沿资讯!
Wiki最后更新:2018-1-13
如何在Linux下禁用IPv6 Linux

如何在Linux下禁用IPv6

IPv6被认为是IPv4——互联网上的传统32位地址空间——的替代产品,它用来解决现有IPv4地址空间即将耗尽的问题。然而,由于已经有大量主机、设备用IPv4连接到了互联网上,所以想在一夜之间将它们全...
Nginx 启用 proxy_cache 缓存 Wiki

Nginx 启用 proxy_cache 缓存

顾名思义,proxy_cache 是用于 proxy 模式(一般也可称为反代)的缓存功能。本文介绍其基本用法。 proxy_cache 在 Nginx 配置的 http 段、server 段(loca...
匿名

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定