NextCloud是一个开源套件的Client-Server软件,用于创建和使用文件托管服务。有很多方法可以安装它,这里是我可以通过使用Docker来提升和运行最容易的方式。 

使用Docker和Portainer创建您的云VM

1  在云中安装Ubuntu或CentOS。将其更新至最新状态。

将Ubuntu更新并升级到最新 

$ sudo apt-get -y update && sudo apt-get -y upgrade

2  Install Docker


对于CentOS:

sudo -i
yum -y update
curl -sSL //get.docker.com/ | sh
systemctl start docker.service
systemctl enable docker.service


For Ubuntu

sudo apt update
sudo apt upgrade
sudo apt install docker.io -y
sudo -i
systemctl start docker
systemctl enable docker
docker version

3  Install Portainer

docker volume create portainer_data
docker run -d -p 9000:9000 --name portainer --restart always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer
docker ps
Use your browser to access URL http://<public ip of your linuxserver>:9000
First time, it will ask you to set up admin user's password.


创建nginx容器



nginx正在使用桥接网络。重新启动策略也设置为始终设置。 

[email protected]:/etc/nginx/conf.d# apt-get update
[email protected]/etc/nginx/conf.d# apt-get install nano

Portainer Docker的nginx配置。 

[email protected]:/etc/nginx/conf.d# cat portainer.conf 
server {
    listen       80;
    server_name  opc1portainer.51sec.org;

location / {
    proxy_pass       http://132.145.9.41:9000;
    proxy_redirect             off;
    proxy_http_version         1.1;
    proxy_set_header Upgrade   $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host      $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

创建NextCloud容器

1  创建NextCloud容器


2  将TCP 8080添加到云防火墙或安全组中

3  为NextCloud域URL添加DNS记录

4  配置nginx以使用您自己的域来访问您的NextCloud网站


[email protected]:/etc/nginx/conf.d# apt-get update
[email protected]/etc/nginx/conf.d# apt-get install nano
[email protected]:/# ls
bin  boot  dev  etc  home  lib  lib64  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var
[email protected]:/# cd etc
[email protected]:/etc# cd nginx
[email protected]:/etc/nginx# cd conf.d
[email protected]:/etc/nginx/conf.d# ls
default.conf  portainer.conf  nextcloud.conf
[email protected]:/etc/nginx/conf.d# cat nextcloud.conf 
server {
    listen       80;
    server_name  nextcloud.51sec.org;


location / {
    proxy_pass       http://132.145.9.4:8080;
    proxy_redirect             off;
    proxy_http_version         1.1;
    proxy_set_header Upgrade   $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host      $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}
[email protected]:/etc/nginx/conf.d# 
5  Restart Nginx

Service Nginx Restart

更改NextCloud Config.php文件以添加信任域

1  通过您自己的域访问NextCloud将获取以下错误

2  更改配置/ config.php文件以添加新的信任域:nextcloud.51sec.org

from from config / config.php:
'trusted_domains'=>
大批 (
0 => ‘localhost’,
1 => ‘50.60.100.101’,
2 =>'nextcloud.51sec.org',
),

Testing access successful now using my own domain //ift.tt/39aomm0. Here are some screenshots:

来自Blogger. //blog.fabiandinkins.com/2020/11/easiest-way-to-deploy-your-own.html

经过 Jon.

发表评论