Filerun是一个基于PHP的网盘程序。与一般的网盘不同,你可以直接通过SSH操作文件,并直接反映到网盘系统中。

安装

此处使用lnmp套件。

1. 创建站点

lnmp vhost add

2. 配置站点

如果储存文件的目录不在网盘程序所在的目录里面,需要移除open_basedir限制。直接使用LNMP安装中 tools 目录下的 ./remove_open_basedir_restriction.sh 进行移除。

3. 安装Filerun

选择安装包,官方下载页面:https://filerun.com/download

  • PHP7
    下载最新的安装包即可。运行lnmp目录下的 .\addons.sh,安装ioncube。
  • PHP5
    下载2018.11.11安装包。此包适用于PHP5.6-7.2。

4.访问刚刚创建的网站,按提示操作即可。

5.一些问题

1. 安装过程中报错Syntax error or access violation: 1067

MySQL error: SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'created', in: CREATE TABLE `df_collections` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `uid` mediumint(9) NOT NULL, `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci

在MySQL5.6之前的版本中,存放CURRENT_TIMESTAMP的列只能是TIMESTAMP格式,不能是DATETIME。所以将数据库软件升级到新版即可解决。

2. 开启WebDav

WebDav访问地址https://filerun.example.com/dav.php/@Home
我这里测试只能使用管理员账户成功登录,也就是初始用户名为superuser、用户ID为1的账户。
Nginx可使用以下配置文件,域名、root目录和证书文件请根据自己的实际情况进行更改。

server
    {
        listen 443 ssl http2;
        listen [::]:443 ssl http2;
        server_name filerun.example.com ;
        index index.html index.htm index.php default.html default.htm default.php;
        root  /home/wwwroot/filerun;

        ssl_certificate /etc/ssl/example.crt;
        ssl_certificate_key /etc/ssl/example.key;
        ssl_session_timeout 5m;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
        ssl_prefer_server_ciphers on;
        ssl_ciphers "TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5";
        ssl_session_cache builtin:1000 shared:SSL:10m;
        # openssl dhparam -out /usr/local/nginx/conf/ssl/dhparam.pem 2048
        ssl_dhparam /usr/local/nginx/conf/ssl/dhparam.pem;

        include rewrite/other.conf;
        #error_page   404   /404.html;

        # Deny access to PHP files in specific directory
        #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
        
        location ~ [^/]\.php(/|$) {
            fastcgi_split_path_info ^(.+?\.php)(/.*)$;
            if (!-f $document_root$fastcgi_script_name) {
                return 404;
            }

            # Mitigate https://httpoxy.org/ vulnerabilities
            fastcgi_param HTTP_PROXY "";

            fastcgi_pass unix:/tmp/php-cgi.sock;
            fastcgi_index index.php;

            # include the fastcgi_param setting
            #include fastcgi_params;

            include fastcgi.conf;

            # SCRIPT_FILENAME parameter is used for PHP FPM determining
            #  the script name. If it is not set in fastcgi_params file,
            # i.e. /etc/nginx/fastcgi_params or in the parent contexts,
            # please comment off following line:
            # fastcgi_param  SCRIPT_FILENAME   $document_root$fastcgi_script_name;
        }

        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
            expires      30d;
        }

        location ~ .*\.(js|css)?$
        {
            expires      12h;
        }

        location ~ /.well-known {
            allow all;
        }

        location ~ /\.
        {
            deny all;
        }

        access_log off;
    }
文章目录