In this guide I’ll provide a complete and secure Nextcloud setup for the WD My Cloud NAS.
- Cloud access directly to your box, not via WD servers
- Better integration with multiple apps available for any platform (so it’s a valid replacement for the deprecated PC suite)
- Modern look and feel
- Many extensions available
- Automatic HTTPS certificates with LetsEncrypt
- The WD web interface must be disabled to run Nextcloud. You can switch it back on, but its either WD web or Nextcloud, not both.
- Only static public IP addresses supported for now… feel free to setup DynDNS / NoIP
- Use at your own risk. WD support won’t help you here. You need SSH access to set it up.
Step 1: Get Docker and Docker Compose
Docker is available here. Install it with the WD web interface.
Docker Compose can be installed on all WD platforms with python pip.
Get Entware from wdcommunity.com and install it with the WD web interface.
opkg install python-pip pip install setuptools pip install docker-compose
Verify it worked
# which docker-compose /opt/bin/docker-compose
Step 2: Get a domain
You really need a domain name, otherwise you’ll have to deal with big security warnings in your browser.
Just google for a free one if you don’t want to pay for it.
Step 3: Open up port 80 and 443 in your home router. I’m assuming you’re connected to your ISP behind a router here. Forward port 80 and 443 of the IP of your NAS to the public WAN.
Step 4: Stop the WD web interface
Open up an SSH session to your My Cloud NAS and stop the apache service.
kill $(pidof httpd)
Ensure ports 80 and 443 are free. No process may occupy these ports.
netstat -tulpn | grep 80 netstat -tulpn | grep 443
Step 5: Prepare a working directory
cd /shares/Volume_1 mkdir nextcloud && cd nextcloud
Step 6: Get the Docker Compose yaml and run the whole stack
opkg install git-http
Pick the set of instructions that applies to your NAS.
Instructions for WD MyCloud PRx100 or DLx100 NAS
git clone https://github.com/nextcloud/docker cd docker/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/apache
Step 7: Edit the config
Edit the database variables
i to enter editing mode.
Generate a strong password for mysql user.
ESC and type
:wq to save and quit.
Edit the compose file
i to enter editing mode.
Set a strong password for MYSQL_ROOT_PASSWORD, fill in your domain name (see step 2)
- VIRTUAL_HOST=mycloud.domain.com - LETSENCRYPT_HOST=mycloud.domain.com - LETSENCRYPT_EMAILemail@example.com # used for expiration warnings
ESC and type
:wq to save and quit.
Now simply bring up the whole stack
docker-compose up -d
And now your site should be available in a few minutes…
Ignore the instructions for ARM below.
Instructions for other ARM based My Cloud NAS
Build and run the nginx proxy service for ARM. This may take a while.
git clone https://github.com/stefaang/multiarch-letsencrypt-nginx-proxy cd multiarch-letsencrypt-nginx-proxy/nginx-proxy-2containers docker-compose up -d
Now prepare the Nextcloud app.
It’s hard to find a Mariadb / Mysql (InnoDB) / Postgres database for ARMv7. I’ve tested many images from docker hub and almost none of them were compatible with Nextcloud.
TODO: add beercan1989/arm-mysql + redis + cron
Create a docker-compose.yml with the following content (and update the environment values)
version: '3.1' volumes: nextcloud: services: app: image: nextcloud restart: always environment: NEXTCLOUD_ADMIN_USER: admin NEXTCLOUD_ADMIN_PASSWORD: verysecretpassword VIRTUAL_HOST: mycloud.domain.com LETSENCRYPT_HOST: mycloud.domain.com LETSENCRYPT_EMAIL: firstname.lastname@example.org volumes: - nextcloud:/var/www/html - /shares/Public:/mnt/Public # add any share you want networks: default: external: name: webproxy
Start the Nextcloud app. The nginx proxy helper should generate a LetsEncrypt certificate automatically for your domain.
export COMPOSE_HTTP_TIMEOUT=300 docker-compose up -d
Open up your domain in the browser and enjoy your personal cloud!
Add existing WD shares as External Storage
Your existing shares are normally not available in the Nextcloud container.
Edit the docker-compose.yml and add the full share path (e.g.
/shares/Public) to the nextcloud app with a mountpoint (e.g.
services: app: ... volumes: - nextcloud:/var/www/html - /shares/Public:/mnt/Public # add any share you want
In the Nextcloud menu, go to apps and install the External Storage application.
In the Nextcloud configuration menu, in the admin tab, select External Storage.
Add a source with type
Local and path
Now you can access the Public share from within your cloud.
Restore WD web UI
If you wish to start the WD web interface again later, ensure ports 80 and 443 are free by stopping the apps
and then start apache again
httpd -f /usr/local/apache2/conf/httpd.conf -k graceful
Nextcloud command line
You can setup this alias for the docker command line
alias occ="docker-compose exec --user www-data app php occ"
occ status - installed: true - version: 18.104.22.168 - versionstring: 15.0.0 - edition:
Trusted domain access
If you get an error about access denied for untrusted domain, you’ll need to add your domain to the trusted domains. This can be done with the Nextcloud command line.
List the domains
occ config:system:get trusted_domains
Add your domain
occ config:system:set trusted_domains 1 --value=mycloud.domain.com
Alternative solution: edit config.php in the nextcloud data volume manually.
Here’s how to look it up.
# cdnp && cd _docker/volumes # find . -wholename "*/config/config.php" ./nextcloud_nextcloud/_data/config/config.php
Edit the file
/ and type
trust to go to the section with trusted domains, press
i to enter text mode and fill in your hostname
'trusted_domains' => array ( 0 => 'mycloud.mooo.com', )
Press ESC, type
:wq to write and quit.
Now reload the website in your browser.
Show running containers
Show logs for the nextcloud_db container
docker logs nextcloud_db
Good luck and enjoy!