sep.cc 如涉及侵权内容,请联系 cyclists@outlook.com

Directory Lister调用CDN实现本地化

用Nginx简单的做了一个目录程序下载站,不需要复杂的架构,简单易用,高效,足够。

Nginx目录程序使用了好几个,发觉最简洁的还是Directory Lister,刚开始使用的时候,程序自带的是官方google源,每次访问自己的下载站都要加载最少10秒,众所周知的原因,大多数google服务在中国都不能使用,就算能使用速度也会很慢。

本站提供的Directory Lister目录列表程序已经修改为本地化,自动调用国内中科大CDN,实现秒加载。

下载压缩文件后,解压并上传到已经搭建好 PHP和HTTP环境的服务器中,然后即可上传文件和创建文件夹了!

比如你的站点安装在/root/www/wwwroot,直接在当前站点根目录新建一个down(名字随意)文件夹,程序压缩包有一个文件夹和index.php文件,直接解压到down文件夹里,即可访问 https://xxx.xxx.xxx/down/

注意事项:

不显示文件和目录

如果安装 lnmp一键包上传Directory Lister后,Directory Lister不显示文件和目录,那么可能是 PHP函数 scandir 被禁用了,取消禁用即可。

sed -i 's/,scandir//g' /usr/local/php/etc/php.ini

取消scandir函数禁用

/etc/init.d/php-fpm restart

重启 PHP生效

文件修改说明:

修改网站头部导航标题;

\resources\DirectoryLister.php

修改网站标签栏的标题;

\resources\themes\bootstrap\index.php

网站头部公共文件:

\resources\themes\bootstrap\default_header.php

网站底部公共文件:

\resources\themes\bootstrap\default_footer.php

index.php文件修改前:

<head>

        <title>Directory listing</title>
        <link rel="shortcut icon" href="<?php echo THEMEPATH; ?>/img/favicon.ico">

        <!-- STYLES -->
        <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
        <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
        <link rel="stylesheet" type="text/css" href="<?php echo THEMEPATH; ?>/css/style.css">

        <!-- SCRIPTS -->
        <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
        <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
        <script type="text/javascript" src="<?php echo THEMEPATH; ?>/js/directorylister.js"></script>

        <!-- FONTS -->
        <link rel="stylesheet" type="text/css"  href="//fonts.googleapis.com/css?family=Cutive+Mono">

        <!-- META -->
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta charset="utf-8">

        <?php file_exists('analytics.inc') ? include('analytics.inc') : false; ?>

    </head>

index.php文件修改后:

    <head>

        <title>Googlo Downloaded</title>
        <link rel="shortcut icon" href="https://xxx.xx/downs/resources/themes/bootstrap/img/folder.png">

        <!-- STYLES -->
        <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.4/css/bootstrap.min.css">
        <link rel="stylesheet" href="https://cdn.bootcss.com/font-awesome/4.3.0/css/font-awesome.min.css">
        <link rel="stylesheet" type="text/css" href="https://xxx.xx/downs/resources/themes/bootstrap/css/style.css">

        <!-- SCRIPTS -->
        <script type="text/javascript" src="https://ajax.proxy.ustclug.org/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
        <script src="https://cdn.bootcss.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
        <script type="text/javascript" src="https://xxx.xx/downs/resources/themes/bootstrap/js/directorylister.js"></script>

        <!-- FONTS -->
        <link rel="stylesheet" type="text/css"  href="https://fonts.proxy.ustclug.org/css?family=Raleway:400,200,100,300,500,600,700,800,900">

        <!-- META -->
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta charset="utf-8">
        <style>
        #directory-listing {
          /*font-family: "Source Sans Pro", sans-serif;*/
          font-family:"Microsoft YaHei";
          color: #656565;
        }
        </style>
        
    </head>

下载地址:

Directory Lister.zip

最后编辑:2024年2月20日 02:14:13「本站部分内容具有时效性,如遇失效请留言反馈」

转载声明:本站所有内容采用 CC BY-NC-SA 国际许可协议,转载请注明来源:Sep blog,谢谢!

版权声明:如文章内容涉及侵权,请联系 cyclists@outlook.com,待查证属实之后会立刻删除侵权内容。

评论 (1)
  1. avatar
    沙发
    zhujiwiki 2017-11-19 21:31

    可以提高访问速度。
    Directory Lister,目录好程序