差異處

這裏顯示兩個版本的差異處。

連向這個比對檢視

下次修改
前次修改
tech:nextcloud [2021/06/18 12:04] – 建立 jonathantech:nextcloud [2023/11/21 16:59] (目前版本) – [使用 Ubuntu + Docker 安裝方式] jonathan
行 1: 行 1:
 ====== NextCloud 安裝設定紀錄 ====== ====== NextCloud 安裝設定紀錄 ======
-===== 安裝方式 ===== +===== 使用 Ubuntu + Docker 安裝方式 ===== 
-  * 使用 PVE 內的 CT Templates : debian-10-turnkey-nextcloud_16.1-1_amd64.tar.gz+  * 參考 - https://github.com/nextcloud/all-in-one 
 +  * 安裝 docker <cli> 
 +curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - 
 +sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" 
 +sudo apt install docker.io docker-compose-plugin 
 +</cli> 
 +  * 將 jonathan 加入 docker <cli> 
 +sudo usermod -aG docker jonathan 
 +</cli> 
 +  * 依據 [[https://github.com/nextcloud/all-in-one/blob/main/compose.yaml|compose.yaml]] 檔案內容進行調整<cli> 
 +services: 
 +  nextcloud-aio-mastercontainer: 
 +    image: nextcloud/all-in-one:latest 
 +    init: true 
 +    restart: always 
 +    container_name: nextcloud-aio-mastercontainer 
 +    volumes: 
 +      - nextcloud_aio_mastercontainer:/mnt/docker-aio-config 
 +      - /var/run/docker.sock:/var/run/docker.sock:ro 
 +    ports: 
 +      - 8080:8080 
 +    environment: 
 +      - SKIP_DOMAIN_VALIDATION=true 
 +      - NEXTCLOUD_DATADIR=/opt/stacks/nextcloud/ncdata 
 +      - NEXTCLOUD_MOUNT=/mnt/ 
 +volumes: 
 +  nextcloud_aio_mastercontainer: 
 +    name: nextcloud_aio_mastercontainer 
 +</cli> 
 +  * 連上 https://server_ip:8080 
 + 
 +<note tip> 
 +  * 如果第一時間沒有看到 AIO password 可以透過以下方式取得 <cli> 
 +sudo docker exec nextcloud-aio-mastercontainer grep password 
 +</cli> 
 +</note> 
 + 
 +==== 參考網址 ==== 
 +  * https://github.com/nextcloud/all-in-one/discussions/1786 
 + 
 +===== 使用 PVE 內的 CT Templates 安裝方式 ===== 
 +  * CT Templates : debian-10-turnkey-nextcloud_16.1-1_amd64.tar.gz
   * 如果沒有正式 SSL 憑證, 須將設定安裝 NextCloud 的 Domain Name 或 IP 必須要加入 config 定義的 trusted_domains 內 Exp. 192.168.11.24 <cli>   * 如果沒有正式 SSL 憑證, 須將設定安裝 NextCloud 的 Domain Name 或 IP 必須要加入 config 定義的 trusted_domains 內 Exp. 192.168.11.24 <cli>
 cd /var/www/nextcloud cd /var/www/nextcloud
行 18: 行 59:
 </file> </file>
  
 +===== 解決安全設定警告項目 =====
 +  * 缺少安裝 bcmath PHP 套件問題
 +    * 安裝 php-bcmath<cli>
 +apt install php-bcmath
 +</cli>
 +    * 重啟 apache <cli>
 +systemctl restart apache2
 +</cli>
 +  * 新增「default_phone_region」
 +    * 編輯 config.php <cli>vi /var/www/nextcloud/config/config.php</cli><file>
 +:
 +:
 +  'default_phone_region' => 'TWN',
 +);
 +</file>
 +
 +===== 重新設定 admin 密碼 =====
 +  * 參考 - https://docs.nextcloud.com/server/latest/admin_manual/configuration_user/reset_admin_password.html
 +  * 在主機內使用 www-data 身分直接用命令執行重設密碼 <cli>
 +apt install sudo
 +sudo -u www-data php /var/www/nextcloud/occ user:resetpassword admin
 +</cli>
 +  * ++實際操作紀錄|<cli>
 +root@nextcloud ~# sudo -u www-data php /var/www/nextcloud/occ user:resetpassword admin 
 +Enter a new password: 
 +Confirm the new password: 
 +Successfully reset password for admin
 +</cli>++
 +
 +===== 設定 Let's Encrypt SSL 憑證 =====
 +  * 參考 - https://nextcloudpi-documentation-taiwan-traditional-chinese.readthedocs.io/zh_TW/latest/Configure/How-to-get-certificate-with-Letsencrypt-using-DNS-to-verify-domain/
 +  * Exp. 使用 Cloudflare 管理 DNS , 要申請 nextcloud.ichiayi.com 的 SSL 憑證, 執行方式
 +    - <cli>
 +apt install certbot python-certbot-apache
 +certbot -d nextcloud.ichiayi.com --manual --preferred-challenges dns certonly
 +</cli>
 +    - 需要依照訊息顯示至 DNS 增加 TXT Record Exp. <cli>
 +_acme-challenge.nextcloud.ichiayi.com
 +
 +yWQSKEASom2ngmRnohuDjVGJPA08d1DfZovl-JKnk-U
 +</cli>
 +    - 編輯 nextcloud.conf 定義憑證檔路徑 <cli>
 +vi /etc/apache2/sites-enabled/nextcloud.conf 
 +</cli><file>
 +:
 +<VirtualHost *:443>
 +    SSLEngine on
 +    ServerAdmin webmaster@localhost
 +    DocumentRoot /var/www/nextcloud/
 +
 +    SSLCertificateFile    /etc/letsencrypt/live/nextcloud.ichiayi.com/fullchain.pem
 +    SSLCertificateKeyFile /etc/letsencrypt/live/nextcloud.ichiayi.com/privkey.pem
 +
 +    <IfModule mod_headers.c>
 +:
 +</file>
 +    - 編輯 config 檔案將正式憑證的網址設定為 trusted_domains 的第一項 <cli>
 +vi /var/www/nextcloud/config/config.php</cli><file>
 +:
 +  'trusted_domains' =>
 +  array (
 +    0 => 'nextcloud.ichiayi.com',
 +1 => '192.168.11.24',
 +  ),
 +  'datadirectory' => '/var/www/nextcloud-data',
 +  'dbtype' => 'mysql',
 +:
 +</file>
 +    - 重新啟動 apache2 <cli>
 +service apache2 restart
 +</cli>
  
 {{tag>nextcloud tips}} {{tag>nextcloud tips}}
 +
  • tech/nextcloud.1623989097.txt.gz
  • 上一次變更: 2021/06/18 12:04
  • jonathan