2023年5月的時候,Nextcloud終於釋出27.0版本,Nextcloud是繼Owncloud後最亮眼的opensource雲端硬碟服務
透過website的方式即可在瀏覽器上閱覽雲端硬碟裡的圖片、影片、pdf文檔甚至是線上office文件,如同Google Drive一般、搭配Nextcloud PC客戶端軟體能做到隨時隨地將私有文件在不同的設備裡帶著跑,隨安裝搭配附送的Talk應用更讓Nextcloud有別於其他雲端硬碟軟體,提供了訊息、通話、視頻等溝通功能,成為中小企業辦公室內相當優秀的產品選擇本次主題將透過docker-compose安裝新版nextcloud、透過nginx reverse proxy提供外部服務以及如何在docker部署下替你的nextcloud整合線上office作業,實驗架構的邏輯部分如下圖,由前端nginx提供ssl,將用戶需求轉至後端的nextcloud應用服務
安裝步驟
- 本例作業系統為RockyLinux 8.8
1. 如果你的主機上並沒有安裝docker和docker-compose,才需執行這個步驟
[root@host ~]# dnf install -y nano wget git [root@host ~]# wget https://download.docker.com/linux/centos/docker-ce.repo [root@host ~]# mv docker-ce.repo /etc/yum.repos.d/ [root@host ~]# dnf install -y docker-ce-20.10.24 [root@host ~]# systemctl enable docker && systemctl start docker [root@host ~]# curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose [root@host ~]# chmod +x /usr/local/bin/docker-compose [root@host ~]# docker-compose --version docker-compose version 1.29.2, build 5bezea4c
2. 預設擺放nextcloud容器相關資料的資料夾,本例預設為/root/docker_home
[root@host ~]# mkdir -p ~/docker_home/nextcloud && cd ~/docker_home/nextcloud [root@host nextcloud]# mkdir db nextcloud [root@host nextcloud]# nano docker-compose.yml
<docker-compose.yml>
version: '2' services: db: image: mariadb:10.6 restart: always container_name: nextcloud-db command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW volumes: - ./db:/var/lib/mysql environment: - MYSQL_ROOT_PASSWORD=YourPassword - MYSQL_PASSWORD=nextcloud - MYSQL_DATABASE=nextcloud - MYSQL_USER=nextcloud networks: - nextcloud-network # 使用最新版Nextcloud + Apache映像檔 app: image: nextcloud:27.0.2 restart: always container_name: nextcloud depends_on: - db # 預設對外通訊埠是8888 ports: - 8888:80 links: - db volumes: - ./nextcloud:/var/www/html environment: - PHP_MEMORY_LIMIT=512M - PHP_UPLOAD_LIMIT=1024M - MYSQL_PASSWORD=nextcloud - MYSQL_DATABASE=nextcloud - MYSQL_USER=nextcloud - MYSQL_HOST=db networks: - nextcloud-network collabora: image: collabora/code:6.4.14.3 restart: always container_name: nextcloud-collabora environment: # collabora會被哪個website使用 - domain=test-nextcloud\\.example\\.com - username=admin - password=admiN336699 - extra_params=--o:ssl.enable=false --o:ssl.termination=true cap_add: - MKNOD ports: - 9980:9980 networks: nextcloud-network: external: false
3. 啟動docker-compose相關容器,大約一分鐘內會啟動完畢
[root@host nextcloud]# docker-compose up -d [root@host nextcloud]# docker-compose ps Name Command State Ports ------------------------------------------------------------------------------------------------------- nextcloud-collabora /start-collabora-online.sh Up 0.0.0.0:9980->9980/tcp,:::9980->9980/tcp nextcloud /entrypoint.sh apache2-for ... Up 0.0.0.0:8888->80/tcp,:::8888->80/tcp nextcloud-db docker-entrypoint.sh --tra ... Up 3306/tcp
4. 這裡我們預設你的前端主機已經安裝好nginx、配置好相關ssl憑證、並已於DNS設定好了nextcloud和collabora office的a record指向,關於website的配置檔案,注意nextcloud在nginx設定檔的server區塊內,需加入webdav支持的相關設定
location /.well-known/carddav { return 301 $scheme://$host/remote.php/dav; } location /.well-known/caldav { return 301 $scheme://$host/remote.php/dav; }
nginx詳細設定請參閱官方文件 https://docs.nextcloud.com/server/latest/admin_manual/installation/nginx.html
5. 瀏覽器開啟並登入nextcloud網址進行管理員帳密配置與系統安裝 https://test-nextcloud.example.com
6. 安裝推薦application
7. 至此安裝完畢
8. 配置nextcloud website所需的其他設定
[root@host nextcloud]# nano nextcloud/config/config.php
<config.php>
'overwrite.cli.url' => 'https://test-nextcloud.example.com',
'overwriteprotocol' => 'https',
.
..
...
'mail_smtpmode' => 'smtp',
'mail_sendmailmode' => 'smtp',
'mail_smtphost' => 'smtp.gmail.com',
'mail_smtpport' => '465',
'mail_smtpsecure' => 'ssl',
'mail_smtpauth' => 1,
'mail_smtpname' => 'YourGmailAccountName',
'mail_smtppassword' => 'YourGoogleAppSecret',
'mail_from_address' => 'YourGmailAccountName',
'mail_domain' => 'gmail.com',
'auth.bruteforce.protection.enabled' => false,
);
bruteforce參數設定讓處於共用IP的辦公室不會受到短時間內同一IP限制多次存取的保護限制,nextcloud內部郵件寄送這邊採用的是你的gmail轉寄機制,需至google取得應用程式密碼填入mail_smtppassword參數裡。
關於 Nextcloud 的 Configration Parameters 詳細說明可以參閱 官方文件
9. 至右上 Admin頭像>管理設定>管理>Nextcloud office 選項中配置office設定,將Collabora Online伺服器指向先前你所配置的https域名
10. 測試瀏覽器線上開啟office相關文件無誤
0 Comments:
張貼留言