Nextcloud是私有云盘服务应用,由开源的Owncloud 项目fork而来,其中包含部分Owcloud原开发人员。其中服务器端Nextcloud和Owncloud基本上是一致的(owncloud9 和 nextcloud11),所以两者的安装过程大同小异。
P.S. 个人原本使用免费版的坚果云,因为1G流量实在不够使用,加上以前安装过owncloud,这次试着在服务器的docker上安装nextcloud
Host主机安装Nginx
Host主机配置SSL,安装证书
Docker安装NextCloud,开放8888端口
Host主机反向代理到Docker的NextCloud
测试
1、本机安装Nginx本内容参考:
Nginx安装
也可以使用apt-get install nginx 安装,但文件结构有不同
图片.png
sudo apt-get update云主机是腾讯云,Docker我是使用阿里的Docker镜像安装的,所以这里两对头聚在一起了。。。
图片.png
sudo apt-get install build-essential sudo apt-get install libtool图片.png
安装
#PCRE - Perl Compatible Regular Expressions sudo wget https://ftp.pcre.org/pub/pcre/pcre-8.40.tar.gz sudo tar -zvxf pcre-8.40.tar.gz cd pcre-8.40 sudo ./configure sudo make && sudo make install #zlib - compression && decompression cd /usr/local/src sudo wget sudo tar -zxvf zlib-1.2.11.tar.gz cd zlib-1.2.11 sudo ./configure sudo make && sudo make install #openssl - ssl cd /usr/local/src sudo wget https://github.com/openssl/openssl/archive/OpenSSL_1_1_0e.tar.gz sudo tar -zvxf OpenSSL_1_1_0e.tar.gz cd /usr/local/src sudo wget sudo tar -zvxf nginx-1.11.12 cd nginx-1.11.12 sudo ./configure --sbin-path=/usr/local/nginx/nginx \ --conf-path=/usr/local/nginx/nginx.conf \ --pid-path=/usr/local/nginx/nginx.pid \ --with-http_ssl_module \ --with-pcre=/usr/local/src/pcre-8.40 \ --with-zlib=/usr/local/src/zlib-1.2.11 \ --with-openssl=/usr/local/src/openssl-OpenSSL_1_1_0e sudo make && sudo make install查看
图片.png
配置
cd /usr/local/nginx sudo vim nginx.conf配置文件,重点①内容
#user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; gzip on; server { listen 443 ssl ; ssl_certificate /etc/letsencrypt/live/laurt.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/laurt.com/privkey.pem; ssl_session_timeout 10m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; ssl_ciphers ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:RC4-SHA:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!DSS:!PKS; server_name laurt.com; location / { root /var/www/html; index index.html index.htm; } } # vhost of nextcloud with proxy ① server { listen 443 ssl ; ssl_certificate /etc/letsencrypt/live/laurt.com/fullchain.pem; ② ssl_certificate_key /etc/letsencrypt/live/laurt.com/privkey.pem; ③ ssl_session_timeout 10m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; ssl_ciphers ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:RC4-SHA:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!DSS:!PKS; server_name cloud.laurt.com; ④ location / { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-Forwarded-Proto $scheme; proxy_pass :8888; ⑤ } } server { listen 80; server_name laurt.com; rewrite ^/(.*) https://laurt.com/$1 permanent; } }说明
证书签发的pem文件②和③
设置域名④