Rat's

Use Docker to quickly install NextCloud personal private cloud disk
Note: NexCould is a good and beautiful personal private cloud disk. More and more people are using it now. I sent a regular building tutorial before
Scan the QR code on the right to read the full text
twenty-two
2017/11

Use Docker to quickly install NextCloud personal private cloud disk

explain: NexCould It is a good and beautiful personal private cloud disk. More and more people are using it now. A regular building tutorial has been published before. Please refer to: A good personal private cloud: NextCloud installation tutorial In view of the fact that many people have more or less problems during the construction process, today the blogger posted a very convenient installation method, which is to use Docker install NextCloud You can see that many of these online tutorials are edited docker-compose.yml The file is used for installation, and the reverse proxy is also configured. During this period, many problems are easy to occur, which is unfriendly to novices. This tutorial uses pure commands to install, which is not easy to cause problems, and is suitable for novices.

screenshot

 Please enter a picture description
 Please enter a picture description

to update

Docker The image has been replaced with a more frequently updated and smaller image. The latest stable version is used Alpine Linux , environment is PHP 7 and Nginx

install

Github address: https://github.com/chrootLogin/docker-nextcloud

1. Install 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. Install Nextcloud

 #Pull the MySQL image and remember to modify the database information 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 #Pull the Nextcloud image docker run -d --name nextcloud --link mysqlnc \ -v /root/nextcloud/data:/data \ -p 3000:80 \ rootlogin/nextcloud

Access address is http://IP:3000 , in the startup command three thousand The port can be replaced by itself, but the subsequent commands about the port can be modified by yourself, /root/nextcloud The database is a network disk, which can also be modified by yourself.

about CentOS The system still needs to be turned on three thousand Port, open as follows:

 #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

If you want to access with a domain name, you need to reverse it.

Domain name access

Reverse generation can be used Nginx Apache Caddy , only the pagoda and Caddy If you have a pagoda on your website, you can use it for reverse generation. If not, it is recommended to use the two Specious Caddy Reverse generation, fast configuration.

1. Pagoda counter generation
First enter the pagoda panel, then click the website on the left to add a site, and then click the added domain name. At this time, you will enter the site configuration, click the reverse proxy, and the target URL fill http://127.0.0.1:3000 , and then enable reverse proxy. As for enabling SSL Not to mention, it can be enabled by configuring it directly at the site.

2. Caddy reverse substitution
install 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 #Alternate address wget -N --no-check-certificate  https://www.moerats.com/usr/shell/Caddy/caddy_install.sh  && chmod +x caddy_install.sh && bash caddy_install.sh

to configure Caddy

 #The following is a whole. Please modify the domain name and copy it to SSH to run! #Http access. This configuration does not automatically issue 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 access. This configuration will automatically issue SSL. Please resolve the domain name to the VPS server in advance 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 The parameters will automatically sign for you ssl Certificate, if you want to use your own ssl , change to tls /root/xx.crt /root/xx.key OK. Followed by ssl Certificate path.

start-up Caddy

 /etc/init.d/caddy start

You can open the domain name for access.

3. Nginx configuration
If you use other ones, you can send them here Nginx The reverse configuration can be directly added to the configuration file.

 #Add in configuration file 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; }

Finally, it should be noted that during installation, Mysql Database address localhost:3306

Vultr New user registration send one hundred USD/ sixteen Each computer room is charged by hour, and Alipay is supported【 Click to view 】。
Last modification: July 19, 2019 05:33 PM

Comment

108 comments

  1. ko

    OP machine (ubuntu 18 system)
    Boss, I want to ask you, if you first install nextcloud (caddy reverse domain name nc.abc.com, the access is normal at this time)
    Then I installed quickboxlite (installed through TUI and also bound to qb. abc. com), and found that the two domains could not be opened. What should I do in this case (pure novice --)

  2. DZ

    After logging in, set the database to appear:
    Error while trying to create admin user: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [2002] No such file or directory
    Please have a look, thank you!

    1. Rat's
      @DZ

      This is not very clear. I haven't met it

  3. f0x

    After caddy reverse generation, how to use domain name access to display "access through untrusted domain name"

  4. xxx101

    Hello blogger, what should I do if I don't have permission to mount the local storage

    1. xxx101
      @xxx101

      Sudo chown - R also tried

  5. bbiinn

    After a long time of trouble, the tutorial of the boss is still useful. It is recommended to replace the nextcloud image with an official image, or a Linux Server image, which is updated and maintained frequently. However, the -- link parameter is really easy to use. Why is it not recommended officially? It's a pity.

    1. bbiinn
      @bbiinn

      By the way, you can add the operation instructions for linking the database after login. Especially, whether localhost: 3306 or mysqlnc: 3306 is the last link port, or both?

      1. Rat's
        @bbiinn

        Forget, they should all be useful. I'll look for the image first

  6. lzbzz

    No Space Left on Device

    1. Rat's
      @lzbzz

      Check whether the hard disk is full. df - h Check

  7. kanlee

    ====Installation succeeded=====

  8. one hundred and twenty-three

    I installed it completely according to this, but IP: 3000 can't access it? solve

    1. Rat's
      @123

      Look at the docker process. If the docker ps has this process, check the firewall port. For example, Alibaba Cloud has security groups on the control panel.

      1. jioke
        @Rat's

        I cannot access IP: 3000 after installation. I don't know where the card is. The firewall must be open

  9. Only love 4:00 in the morning

    Hello, landlord, I am stuck in the final step of installation, and I am prompted "unable to create or write to the data directory/root/nextcloud/data". What's the matter

    1. Rat's
      @Only love 4:00 in the morning

      What database type is selected? Or send your installation link to me privately.

      1. Only love 4:00 in the morning
        @Rat's

        MySQL5.7

        1. mou
          @Only love 4:00 in the morning

          I'm stuck here too. Do you have a solution

  10. man 's life is like a dream

    How to modify the storage directory of nextcloud after Docker installs nextcloud??
    I want to give the hard disk of the whole machine as storage space,,

    1. yj
      @Living like a dream

      When Docker is installed, you can mount the/data folder in the container to the specified directory in the host when starting.
      You can refer to this one to install and connect MySQL based on docker: http://thisforyou.cn:180/blog/2020/03/01/shi -yong-docker-kuai-su-an-zhuang-nextcloud-mysql-ge-ren-si-you-yun-pan-wang-su-chao-kuai/

    2. Rat's
      @Living like a dream

      It seems to be the entire root directory of the default server

      1. man 's life is like a dream
        @Rat's

        No, I tried it. The machine can still store 18G, but I put a 3G file on it, and it said there was no space