自己动手搭建网盘(●—-●)

文章目录
软件介绍准备阶段Step OneStep TwoStep ThreeStep FourStep Five

软件介绍

笔者最近发现了一个非常好玩的开源软件,名字叫seafile, 这里附上它的官网链接

这里说下为什么笔者会看上这款软件(当然这款软件几个功能很好用,而且本身也是小有名气的开源项目了)

场景主要是笔者最近需要一款能够只通过分享链接的形式就可以实现上传下载文件的文件管理软件

之前找了下wordpress的相关插件和百度网盘的功能,并没有发现很合适的。百度网盘有类似的功能

但是为什么不选呢?因为慢!

好,进入正题。笔者发现这款软件后,马上就开始筹划动手搭建了。那么,我就在这里分享我的搭建过程

供他人参考

准备阶段

    软件服务端手册(这个东西官网可以找到链接在此)由于服务端手册可能没持续维护,所以我还找到了它的软件更新日志(链接)软件安装包(这个东西官网也找得到,这里不给链接了,自己找)阿里云竞价服务器一个(我用的是Ubuntu 18.04)域名一个(当然可以不需要,但是有的话我觉得会酷一些)

Step One

首先是登录进阿里云服务器然后准备好软件依赖环境

Mysql

Python2.7及相关工具包

Apache2

软件包下载,解压

work@tomcat:~$ lsb_release -a
LSB Version: core-9.20170808ubuntu1-noarch:security-9.20170808ubuntu1-noarch
Distributor ID: Ubuntu
Description: Ubuntu 18.04.4 LTS
Release: 18.04
Codename: bionic
work@tomcat:~$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 513
Server version: 5.7.31-log MySQL Community Server (GPL)
work@tomcat:~$ apt-get update
work@tomcat:~$ apt-get install python2.7 python-setuptools python-imaging python-ldap python-mysqldb python-memcache python-urllib3
work@tomcat:~$ apt-get install apache2
wong@MacBook-Pro ~ % scp -i xxx.pem ~/Download/seafile-server_* user@host:~/
work@tomcat:~$ mkdir /opt/seafile
work@tomcat:/opt/seafile$ cd /opt/seafile
work@tomcat:/opt/seafile$ mkdir installed
work@tomcat:/opt/seafile$ mv ~/seafile-server_* .
work@tomcat:/opt/seafile$ tar -xzf seafile-server_*
work@tomcat:/opt/seafile$ mv seafile-server_* ./installed/
work@tomcat:/opt/seafile$ tree -L 2
.
├── ccnet [error opening dir]
├── conf [error opening dir]
├── installed
│ └── seafile-server_7.0.5_x86-64.tar.gz
├── logs
│ ├── ccnet.log
│ ├── controller.log
│ ├── seafile.log
│ └── seahub.log
├── pids
│ ├── ccnet.pid
│ ├── seaf-server.pid
│ └── seahub.pid
├── seafile-data [error opening dir]
├── seafile-server-7.0.5
│ ├── check_init_admin.py
│ ├── reset-admin.sh
│ ├── runtime
│ ├── seaf-fsck.sh
│ ├── seaf-fuse.sh
│ ├── seaf-gc.sh
│ ├── seafile
│ ├── seafile.sh
│ ├── seahub
│ ├── seahub.sh
│ ├── setup-seafile-mysql.py
│ ├── setup-seafile-mysql.sh
│ ├── setup-seafile.sh
│ ├── sql
│ └── upgrade
├── seafile-server-latest -> seafile-server-7.0.5
└── seahub-data
└── avatars

15 directories, 18 files

Step Two

然后执行.sh脚本,根据需求进行安装配置

执行目录树的seafile-server-x的setup-seafile-mysql.sh

详细安装步骤看官网文档解释

这里展示笔者的比较重要的配置文件,可供参考

work@tomcat:/opt/seafile/seafile-server-7.0.5$ ./setup-seafile-mysql.sh

root@tomcat:/opt/seafile/conf# cat ccnet.conf
[General]
USER_NAME = sea4me
ID = xxxxxxxxxxxx
NAME = sea4me
SERVICE_URL = http://seafile.xxx.cn

[Client]
PORT = 13419

[Database]
ENGINE = mysql
HOST = 127.0.0.1
PORT = 3306
USER = seafile
PASSWD = seafile
DB = ccnet-db
CONNECTION_CHARSET = utf8

root@tomcat:/opt/seafile/conf# cat gunicorn.conf

import os

daemon = True
workers = 5

# default localhost:8000
bind = "0.0.0.0:8000"

# Pid
pids_dir = '/opt/seafile/pids'
pidfile = os.path.join(pids_dir, 'seahub.pid')

# for file upload, we need a longer timeout value (default is only 30s, too short)
timeout = 1200

limit_request_line = 8190

Step Three

配置Apache2作为seafile主服务的反向代理

这里展示笔者的比较重要的Apache2的配置文件

当然笔者的配置是有缘由的,可理解官方文档进行参考

root@tomcat:/etc/apache2/sites-enabled# cat 000-default.conf
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.

ServerName seafile.xxx.cn
#ServerAdmin webmaster@localhost
DocumentRoot /var/www

Alias /media /opt/seafile/seafile-server-latest/seahub/media

RewriteEngine On

<Location /media>
Require all granted
</Location>

# Redirect permanent "/" "https://seafile.xxx.cn/"

# For seafile server
ProxyPass /seafhttp http://127.0.0.1:8082
ProxyPassReverse /seafhttp http://127.0.0.1:8082
RewriteRule ^/seafhttp - [QSA,L]

# seahub
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
ProxyPass / http://127.0.0.1:8000/
ProxyPassReverse / http://127.0.0.1:8000/

# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

Step Four

启动程序

先开启Apache2

然后开启seafile-server

然后开启seahub-server

root@tomcat:~# service apache2 start
# 用了环境变量,实际上该文件在seafile-server-7.0.5/下
root@tomcat:~# $Seafile/seafile.sh start
root@tomcat:~# $Seafile/seahub.sh start

Step Five

最后当然是见证奇迹的时刻啦!

这里贴上截图,和笔者最看重的两个功能

    这个是登录界面

自己动手搭建网盘(●----●)
2. 这个是我最看重的功能,一个是分享上传文件链接,一个是分享下载链接

自己动手搭建网盘(●----●)
3. 这个是分享的链接

自己动手搭建网盘(●----●)
4. 这个是上传文件视图,还有下载文件视图

自己动手搭建网盘(●----●)

自己动手搭建网盘(●----●)

原创:https://www.panoramacn.com
源码网提供WordPress源码,帝国CMS源码discuz源码,微信小程序,小说源码,杰奇源码,thinkphp源码,ecshop模板源码,微擎模板源码,dede源码,织梦源码等。

专业搭建小说网站,小说程序,杰奇系列,微信小说系列,app系列小说

自己动手搭建网盘(●----●)

免责声明,若由于商用引起版权纠纷,一切责任均由使用者承担。

您必须遵守我们的协议,如果您下载了该资源行为将被视为对《免责声明》全部内容的认可-> 联系客服 投诉资源
www.panoramacn.com资源全部来自互联网收集,仅供用于学习和交流,请勿用于商业用途。如有侵权、不妥之处,请联系站长并出示版权证明以便删除。 敬请谅解! 侵权删帖/违法举报/投稿等事物联系邮箱:2640602276@qq.com
未经允许不得转载:书荒源码源码网每日更新网站源码模板! » 自己动手搭建网盘(●—-●)
关注我们小说电影免费看
关注我们,获取更多的全网素材资源,有趣有料!
120000+人已关注
分享到:
赞(0) 打赏

评论抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

您的打赏就是我分享的动力!

支付宝扫一扫打赏

微信扫一扫打赏