惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
C
Cybersecurity and Infrastructure Security Agency CISA
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Tailwind CSS Blog
G
GRAHAM CLULEY
博客园 - 叶小钗
T
Threatpost
小众软件
小众软件
The Hacker News
The Hacker News
博客园 - 聂微东
博客园 - 三生石上(FineUI控件)
P
Privacy & Cybersecurity Law Blog
AWS News Blog
AWS News Blog
P
Proofpoint News Feed
Jina AI
Jina AI
S
Schneier on Security
N
News | PayPal Newsroom
Help Net Security
Help Net Security
A
Arctic Wolf
T
The Blog of Author Tim Ferriss
大猫的无限游戏
大猫的无限游戏
T
Troy Hunt's Blog
美团技术团队
L
Lohrmann on Cybersecurity
The Last Watchdog
The Last Watchdog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
P
Privacy International News Feed
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
Cisco Blogs
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Hugging Face - Blog
Hugging Face - Blog
B
Blog RSS Feed
The Register - Security
The Register - Security
博客园 - Franky
Stack Overflow Blog
Stack Overflow Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
S
SegmentFault 最新的问题
腾讯CDC
云风的 BLOG
云风的 BLOG
Simon Willison's Weblog
Simon Willison's Weblog
Google DeepMind News
Google DeepMind News
AI
AI
GbyAI
GbyAI
Attack and Defense Labs
Attack and Defense Labs
Cloudbric
Cloudbric
I
Intezer
The GitHub Blog
The GitHub Blog
V2EX - 技术
V2EX - 技术
Scott Helme
Scott Helme
J
Java Code Geeks

Rat's Blog - 云盘

Linux VPS一键安装Seafile搭建私有云盘存储 - Rat's Blog 随心搜:一个可以搜索磁力,百度及各大网盘所有资源的工具 - Rat's Blog Linux VPS使用wget下载百度网盘文件的方法 - Rat's Blog 利用IDM工具高速下载百度云大文件教程 - Rat's Blog 百度网盘直接下载助手 Tampermonkey(油猴)脚本 - Rat's Blog
使用NextCloud来搭建我们的私有网盘、并结合Redis优化性能 - Rat's Blog
博主: Rat's · 2017-06-15 · via Rat's Blog - 云盘

说明:现在越来越多云盘都相继宣布关闭,差不多都去用百度云盘了,而我们手上有些比如小姐姐电影之类传上去就会被和谐,于是我们有必要自己搭建个私有云来存这些资源了,也安全,这里推荐NextCloud,一款继ownCloud之后,又一个很不错的私有云。

简介

Nextcloud是一套用于创建和使用文件托管服务的客户端-服务器软件。它在功能上类似于Dropbox,虽然Nextcloud是免费的和开源的,允许任何人在私人服务器上安装和操作它。与Dropbox等专有服务相反,开放架构允许以应用程序的形式向服务器添加附加功能。

虽然Nextcloud作为ownCloud的衍生版本,在其基础上做了许多改进,但有一些差异。ownCloud提供了一个开源社区版本,但它们还提供了一个专有的企业版,具有附加功能和支持订阅。相比之下,Nextcloud是完全开源的。

截图

请输入图片描述
请输入图片描述

更新

【2019年6月28日】
更新教程,替换为宝塔安装,并新增Redis缓存优化方案以提高NextCloud运行速度。

安装

如果不喜欢折腾的,可参考1分钟就能安装完成的方法:Snap安装教程Docker安装教程

环境要求:PHP 5.6 +MysqlNginxRedis(非必需)。

1、安装宝塔

#CentOS系统
wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh
#Ubuntu系统
wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && sudo bash install.sh
#Debian系统
wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && bash install.sh

安装完成后,进入面板,点击左侧软件商店,然后安装PHP 5.6+MysqlNginxRedis

然后点击左侧软件商店-PHP设置-安装扩展,安装Redis模块即可

接下来点击左侧网站-添加站点,填好域名和Mysql数据库用户名和密码信息。

2、上传Nextcloud程序
Nextcloud程序下载地址→传送门,目前为16.0.1版本,使用命令:

#进入站点根目录,自行修改路径
cd /www/wwwroot/www.moerats.com
#下载最新版程序,记得随时将链接换成最新版的下载地址
wget https://download.nextcloud.com/server/releases/nextcloud-16.0.1.zip
#解压并移动到根目录
unzip nextcloud-*.zip && rm -rf nextcloud-*.zip index.html
mv nextcloud/* . && rm -rf nextcloud
chown -R www:www ./

3、伪静态设置
点击站点设置-伪静态设置,添加以下代码:

location / {
    rewrite ^ /index.php$request_uri;
}

location ~ ^\/(?:build|tests|config|lib|3rdparty|templates|data)\/ {
    deny all;
}

location ~ ^\/(?:\.|autotest|occ|issue|indie|db_|console) {
    deny all;
}

location ~ ^\/(?:updater|oc[ms]-provider)(?:$|\/) {
    try_files $uri/ =404;
    index index.php;
}

location ~ \.(?:css|js|woff2?|svg|gif|map)$ {
    try_files $uri /index.php$request_uri;
    add_header Cache-Control "public, max-age=15778463";
    add_header X-Content-Type-Options nosniff;
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Robots-Tag none;
    add_header X-Download-Options noopen;
    add_header X-Permitted-Cross-Domain-Policies none;
    add_header Referrer-Policy no-referrer;

    access_log off;
}

location ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ {
    try_files $uri /index.php$request_uri;
    access_log off;
}

4、新增Redis缓存配置
使用宝塔点击左侧文件,找到网站根目录的config/config.php配置文件,在后面新增以下代码:

'memcache.locking' => '\OC\Memcache\Redis',
'memcache.distributed' => '\OC\Memcache\Redis',
'redis' => [
     'host' => '127.0.0.1',
     'port' => 6379,
],

5、安装Nextcloud
请输入图片描述
打开网址,选择Mysql数据库,填上数据库信息,并设置管理员账号和密码后,点击安装即可!到这里属于我们的私有云盘Nextcloud就搭建好了。

最后该网盘挺不错的,特别是更新到15.0版本之后,不过加载速度在国内还是慢点,官方推荐的是用APCu缓存,相比较Redis更快,不过博主一般只在小内存上跑,所以就直接使用了Redis缓存。如果你的内存很大,可以看下APCu使用文档→传送门,配置也不难。


版权声明:本文为原创文章,版权归 Rat's Blog 所有,转载请注明出处!

本文链接:https://www.moerats.com/archives/175/

如教程需要更新,或者相关链接出现404,可以在文章下面评论留言。