phpstudy&tinyfilemanager搭建静态文件服务器

tinyfilemanager项目地址:https://github.com/prasathmani/tinyfilemanager

下载小皮面板(phpstudy),并启动nginx,创建网站,指定端口和物理路径,ningx配置文件采用默认的无需修改,

vhosts.conf文件的配置内容:

server {
        listen        1617 ssl;
		ssl_certificate D:/phpstudy_pro/Extensions/Nginx1.15.11/conf/ssl/zc.cwhua.cn.pem;
		ssl_certificate_key D:/phpstudy_pro/Extensions/Nginx1.15.11/conf/ssl/zc.cwhua.cn.key;
		ssl_session_timeout 5m;
		ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
		ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
		ssl_prefer_server_ciphers on;
        error_page 497 301 https://$http_host$request_uri;#配置http跳转https
        server_name  zc.cwhua.cn;
        root   "E:/FTP";
        location / {
            index tinyfilemanager/index.php tinyfilemanager/index.html;
            error_page 400 /tinyfilemanager/error/400.html;
            error_page 403 /tinyfilemanager/error/403.html;
            error_page 404 /tinyfilemanager/error/404.html;
            error_page 500 /tinyfilemanager/error/500.html;
            error_page 501 /tinyfilemanager/error/501.html;
            error_page 502 /tinyfilemanager/error/502.html;
            error_page 503 /tinyfilemanager/error/503.html;
            error_page 504 /tinyfilemanager/error/504.html;
            error_page 505 /tinyfilemanager/error/505.html;
            error_page 506 /tinyfilemanager/error/506.html;
            error_page 507 /tinyfilemanager/error/507.html;
            error_page 509 /tinyfilemanager/error/509.html;
            error_page 510 /tinyfilemanager/error/510.html;
            include E:/FTP/tinyfilemanager/nginx.htaccess;
            autoindex  off;
        }
        location ~ \.php(.*)$ {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  tinyfilemanager/index.php;
            fastcgi_split_path_info  ^((?U).+\.php)(/?.+)$;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            fastcgi_param  PATH_INFO  $fastcgi_path_info;
            fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;
            include        fastcgi_params;
        }
        #禁止访问的目录
        location ^~ /hua {
            deny all;
        }
        location ^~ /long {
            deny all;
        }
        location ^~ /xie {
            deny all;
        }
        location ^~ /xitong {
            deny all;
        }
        #禁止访问的目录
}
server {  #80端口跳转至SSL端口
    listen  80;
    server_name zc.cwhua.cn;
      
    rewrite ^(.*)$  https://$host$1 permanent; 
    # return 302 https://$host$request_uri;
}

index.php内容如下,主要是修改了cdn为国内的。

https://cdn.xxxxx.com/res/web_html5/index.php

config.php内容如下,主要修改了帐号密码和隐藏私密文件。
<?php

/*
#################################################################################################################
This is an OPTIONAL configuration file.
The role of this file is to make updating of "tinyfilemanager.php" easier.
So you can:
-Feel free to remove completely this file and configure "tinyfilemanager.php" as a single file application.
or
-Put inside this file all the static configuration you want and forgot to configure "tinyfilemanager.php".
#################################################################################################################
*/

// Auth with login/password
// set true/false to enable/disable it
// Is independent from IP white- and blacklisting
$use_auth = true;

// Login user name and password
// Users: array('Username' => 'Password', 'Username2' => 'Password2', ...)
// Generate secure password hash - https://tinyfilemanager.github.io/docs/pwd.html
$auth_users = array(
    'admin' => '$2y$10$PLn/6p8Pu9k9SNvCMxXPJeWM/.2gMW05e8xPlFpksCbJfIz0RSfpJiq6m', //乱码内容是php生成的密码hash
    'user' => '$2y$10$4aRSY6d3LI0FHPJgM$PLn/6p8Pu9k9SNvCMxXPJeWM8Pu9k9SNvCM' 
);

// Readonly users
// e.g. array('users', 'guest', ...)
$readonly_users = array(
    'user'
);

//set application theme
//options - 'light' and 'dark'
$theme = 'light';

// Enable highlight.js (https://highlightjs.org/) on view's page
$use_highlightjs = false;

// highlight.js style
// for dark theme use 'ir-black'
$highlightjs_style = 'vs';

// Enable ace.js (https://ace.c9.io/) on view's page
$edit_files = true;

// Default timezone for date() and time()
// Doc - http://php.net/manual/en/timezones.php
$default_timezone = 'Etc/UTC'; // UTC

// Root path for file manager
// use absolute path of directory i.e: '/var/www/folder' or $_SERVER['DOCUMENT_ROOT'].'/folder'
$root_path = 'E:/FTP';

// Root url for links in file manager.Relative to $http_host. Variants: '', 'path/to/subfolder'
// Will not working if $root_path will be outside of server document root
$root_url = '';

// Server hostname. Can set manually if wrong
$http_host = $_SERVER['HTTP_HOST'];

// user specific directories
// array('Username' => 'Directory path', 'Username2' => 'Directory path', ...)
$directories_users = array();

// input encoding for iconv
$iconv_input_encoding = 'UTF-8';

// date() format for file modification date
// Doc - https://www.php.net/manual/en/datetime.format.php
$datetime_format = 'd.m.y H:i:s';

// Allowed file extensions for create and rename files
// e.g. 'txt,html,css,js'
$allowed_file_extensions = '';

// Allowed file extensions for upload files
// e.g. 'gif,png,jpg,html,txt'
$allowed_upload_extensions = '';

// Favicon path. This can be either a full url to an .PNG image, or a path based on the document root.
// full path, e.g http://example.com/favicon.png
// local path, e.g images/icons/favicon.png
$favicon_path = '';

// Files and folders to excluded from listing排除文件和文件夹
// e.g. array('myfile.html', 'personal-folder', '*.php', ...)
$exclude_items = array();//修改了排除文件和文件夹

// Online office Docs Viewer
// Availabe rules are 'google', 'microsoft' or false
// google => View documents using Google Docs Viewer
// microsoft => View documents using Microsoft Web Apps Viewer
// false => disable online doc viewer
$online_viewer = false;

// Sticky Nav bar
// true => enable sticky header
// false => disable sticky header
$sticky_navbar = true;


// max upload file size
$max_upload_size_bytes = 5000;

// Possible rules are 'OFF', 'AND' or 'OR'
// OFF => Don't check connection IP, defaults to OFF
// AND => Connection must be on the whitelist, and not on the blacklist
// OR => Connection must be on the whitelist, or not on the blacklist
$ip_ruleset = 'OFF';

// Should users be notified of their block?
$ip_silent = true;

// IP-addresses, both ipv4 and ipv6
$ip_whitelist = array(
    '127.0.0.1',    // local ipv4
    '::1'           // local ipv6
);

// IP-addresses, both ipv4 and ipv6
$ip_blacklist = array(
    '0.0.0.0',      // non-routable meta ipv4
    '::'            // non-routable meta ipv6
);

?>

posted @ 2021-10-24 21:40  小华仔Pro  阅读(399)  评论(0)    收藏  举报