NextCloud官方提供了docker镜像,官方GitHub:https://github.com/nextcloud/docker ,我使用的是如下命令:
docker run -d \
-v /home/nextcloud-data/nextcloud:/var/www/html \
-v /home/nextcloud-data/apps:/var/www/html/custom_apps \
-v /home/nextcloud-data/config:/var/www/html/config \
-v /home/nextcloud-data/data:/var/www/html/data \
-v /home/nextcloud-data/theme:/var/www/html/themes/kagura \
-p 9000:80 \
-e SQLITE_DATABASE=nextcloud \
--name nextcloud \
nextcloud
我是用了SQLITE,官方还支持环境变量配置MYSQL跟PostgreSQL、设置NextCloud用户信息等。
在服务器执行完这个命令,然后在nginx中配置下反向代理即可:
server
{
listen 443 ssl http2;
#listen [::]:443 ssl http2;
server_name cloud.kagura.me;
ssl on;
ssl_certificate /usr/local/nginx/cert/certificate.crt;
ssl_certificate_key /usr/local/nginx/cert/private.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers "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;
add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:9000/;
}
}
未经允许不得转载:鹞之神乐 » 通过Docker快速搭建NextCloud