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

推荐订阅源

博客园 - 【当耐特】
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Y
Y Combinator Blog
D
DataBreaches.Net
Google DeepMind News
Google DeepMind News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
云风的 BLOG
云风的 BLOG
Recorded Future
Recorded Future
I
InfoQ
L
LangChain Blog
Stack Overflow Blog
Stack Overflow Blog
Recent Announcements
Recent Announcements
宝玉的分享
宝玉的分享
Martin Fowler
Martin Fowler
J
Java Code Geeks
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
A
About on SuperTechFans
人人都是产品经理
人人都是产品经理
G
Google Developers Blog
大猫的无限游戏
大猫的无限游戏
C
Cybersecurity and Infrastructure Security Agency CISA
Know Your Adversary
Know Your Adversary
MongoDB | Blog
MongoDB | Blog
T
Tor Project blog
The Register - Security
The Register - Security
H
Help Net Security
Cisco Talos Blog
Cisco Talos Blog
P
Privacy & Cybersecurity Law Blog
NISL@THU
NISL@THU
P
Palo Alto Networks Blog
B
Blog RSS Feed
Latest news
Latest news
T
Threat Research - Cisco Blogs
The Hacker News
The Hacker News
C
Cisco Blogs
P
Privacy International News Feed
T
The Exploit Database - CXSecurity.com
V
Vulnerabilities – Threatpost
S
Schneier on Security
P
Proofpoint News Feed
Schneier on Security
Schneier on Security
www.infosecurity-magazine.com
www.infosecurity-magazine.com
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
AI
AI
Google Online Security Blog
Google Online Security Blog
H
Hacker News: Front Page
N
News and Events Feed by Topic
W
WeLiveSecurity

Rat's Blog - NextCloud

一个可以自动安装多网站程序的面板 :YunoHost安装教程 - Rat's Blog Cloudbox:一个强大的多功能云媒体服务,可自动获取视频资源并在线播放 - Rat's Blog Sharecmd:一个可以将文件上传至Google Drive/Dropbox并自动生成分享链接的工具 - Rat's Blog Caddy环境下一些Web应用程序的配置参考 - Rat's Blog Ubuntu使用Snap快速安装NextCloud网盘,并配置域名及SSL证书 - Rat's Blog 使用Docker快速安装Aria2+AriaNg+Filerun/Nextcloud,在线下载BT磁链/在线观看/全功能文件管理/云盘应用 - Rat's Blog 使用NextCloud来搭建我们的私有网盘、并结合Redis优化性能 - Rat's Blog
使用Docker快速安装NextCloud个人私有云盘 - Rat's Blog
博主: Rat's · 2017-11-22 · via Rat's Blog - NextCloud

说明:NexCould是一款不错,也很漂亮的个人私有云网盘,现在使用的人是越来越多了,之前发过一篇常规的搭建教程,参考:一款不错的个人私有云:NextCloud安装教程,鉴于很多人在搭建过程中或多或少都会出点问题,今天博主发个很方便的安装方法,就是用Docker安装NextCloud,看到网上很多这样的教程都是通过编辑docker-compose.yml文件来安装的,还要配置反向代理,期间容易出现很多问题,对新手很不友好,而本教程使用纯命令形式安装,不容易出问题,适合尝鲜的新手。

截图

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

更新

Docker镜像已替换成更新比较频繁,体积更加小的镜像,使用的是最新稳定版Alpine Linux,环境为PHP 7Nginx

安装

Github地址:https://github.com/chrootLogin/docker-nextcloud

1、安装Docker

#CentOS 6
rpm -iUvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum update -y
yum -y install docker-io
service docker start
chkconfig docker on

#CentOS 7、Debian、Ubuntu
curl -sSL https://get.docker.com/ | sh
systemctl start docker
systemctl enable docker

2、安装Nextcloud

#拉取Mysql镜像,记得修改数据库信息
docker run --name mysqlnc -d \
-p 3306:3306 \
-e MYSQL_ROOT_PASSWORD=moerats \
-e MYSQL_DATABASE=moerats \
-e MYSQL_USER=moerats \
-e MYSQL_PASSWORD=moerats \
-v /root/nextcloud/mysql:/var/lib/mysql \
mysql:5.7

#拉取Nextcloud镜像
docker run -d --name nextcloud --link mysqlnc \
-v /root/nextcloud/data:/data \
-p 3000:80 \
rootlogin/nextcloud

访问地址为http://IP:3000,启动命令里的3000端口可自行替换,不过后面有关端口的命令都自行修改,/root/nextcloud为网盘的数据库,也可以自行修改。

对于CentOS系统,还需要开启3000端口,开启如下:

#CentOS 6
iptables -I INPUT -p tcp --dport 3000 -j ACCEPT
service iptables save
service iptables restart

#CentOS 7
firewall-cmd --zone=public --add-port=3000/tcp --permanent
firewall-cmd --reload

如果要用域名访问,就需要反代了。

域名访问

反代可以用NginxApacheCaddy,这里只说宝塔和Caddy。如果你网站有宝塔,就可以使用宝塔进行反代,如果没有,建议使用第2种的Caddy反代,配置很快。

1、宝塔反代
先进入宝塔面板,然后点击左侧网站,添加站点,然后再点击添加好了的域名名称,这时候就进入了站点配置,点击反向代理,目标URL填入http://127.0.0.1:3000,再启用反向代理即可。至于启用SSL就不说了,直接在站点配置就可以启用。

2、Caddy反代
安装Caddy

wget -N --no-check-certificate https://raw.githubusercontent.com/iiiiiii1/doubi/master/caddy_install.sh && chmod +x caddy_install.sh && bash caddy_install.sh
#备用地址
wget -N --no-check-certificate https://www.moerats.com/usr/shell/Caddy/caddy_install.sh && chmod +x caddy_install.sh && bash caddy_install.sh

配置Caddy

#以下全部内容是一个整体,请修改域名后一起复制到SSH运行!

#http访问,该配置不会自动签发SSL
echo "xx.com {
 gzip
 proxy / 127.0.0.1:3000 {
    header_upstream Host {host}
    header_upstream X-Real-IP {remote}
    header_upstream X-Forwarded-For {remote}
    header_upstream X-Forwarded-Port {server_port}
    header_upstream X-Forwarded-Proto {scheme}
  }
}" > /usr/local/caddy/Caddyfile

#https访问,该配置会自动签发SSL,请提前解析域名到VPS服务器
echo "xx.com {
 gzip
 tls admin@moerats.com
 proxy / 127.0.0.1:3000 {
    header_upstream Host {host}
    header_upstream X-Real-IP {remote}
    header_upstream X-Forwarded-For {remote}
    header_upstream X-Forwarded-Port {server_port}
    header_upstream X-Forwarded-Proto {scheme}
  }
}" > /usr/local/caddy/Caddyfile

tls参数会自动帮你签发ssl证书,如果你要使用自己的ssl,改为tls /root/xx.crt /root/xx.key即可。后面为ssl证书路径。

启动Caddy

/etc/init.d/caddy start

就可以打开域名进行访问了。

3、Nginx配置
如果你使用其它的,这里就大概发个Nginx反代配置,直接添加到配置文件即可。

#在配置文件里添加
location / {
     proxy_pass http://127.0.0.1:3000;
     proxy_redirect off;
     proxy_set_header X-Real-IP $remote_addr;
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

最后要注意的是,安装的时候,Mysql数据库地址填localhost:3306


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

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

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