Wiki > Nextcloud
Nextcloud is a self-hosted platform for sharing files and using other productivity applications on the web and mobile devices.
Pre-install notes
If you have previously configured nginx, be sure you have an up to date nginx.conf file that contains the line include /home/user/.config/nginx/includes/*.conf;
Setup
-
Follow the directions in the Userland Nginx article to enable nginx and PHP on your slot. Make a note of the port number your nginx configuration is using, as it will be needed below.
-
Create the ~/.config/nginx/includes/nextcloud.conf file by running
touch ~/.config/nginx/includes/nextcloud.confand add the following content to it:location ~ ^/nextcloud { error_page 403 /core/templates/403.php; error_page 404 /core/templates/404.php; auth_basic "off"; client_max_body_size 512M; fastcgi_buffers 64 4K; location ~ ^/nextcloud/(data|config|\.ht|db_structure\.xml|README) { deny all; } location ~ ^(.+?\.php)(/.*)?$ { try_files $1 =404; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$1; fastcgi_param PATH_INFO $2; fastcgi_pass unix:/home/user/.config/php-fpm2/socket; } location ~* ^.+\.(jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ { expires 30d; # Optional: Don't log access to assets access_log off; } } -
Restart nginx by running
killall nginx; ~/.config/nginx/start -
Enter the root of your nginx server. This is the path under
# path you want to sharein your~/.config/nginx/nginx.conffile. By default, this is/home/user/files:cd /home/user/files -
Download and extract Nextcloud by running
wget https://download.nextcloud.com/server/releases/latest.zip; unzip latest.zip; rm latest.zip -
Go to
http://server.whatbox.ca:29952/nextcloud/index.php(orhttps://server.whatbox.ca:29952/nextcloud/index.phpif you're using SSL) to complete the Nextcloud installation. Replace29952with the proper port from your nginx configuration.
Further support for using Nextcloud can be found in Nextcloud's official documentation
HTTPS with Managed Link (optional)
If you are using a managed link to access your Nginx web server, you will need to update Nextcloud's config.php file to allow the domain. Run the following command to add your managed link as a trusted domain. Replace the domain name with the correct managed link to your Nginx server.
php ~/files/nextcloud/occ config:system:set trusted_domains 1 --value="nginx.yourlink.box.ca"
Replace the domain name with the correct managed link to your Nginx server when running this next command:
php ~/files/nextcloud/occ config:system:set overwritehost --value="nginx.yourlink.box.ca"
Next, run the following commands:
php ~/files/nextcloud/occ config:system:set overwriteprotocol --value=https
php ~/files/nextcloud/occ config:system:set trusted_proxies 0 --value="127.0.0.1"
Upgrading your Nextcloud platform
You may need to reconfigure or update your Nextcloud installation when there is an update to PHP. Older versions of PHP are kept in /usr/bin/php so you can run use php8.1 and php-fpm8.1 to access and manage older Nextcloud applications (versions up to 25). If you want to upgrade from an older version of Nextcloud, you will need to upgrade for each major release, so to go from 25 to 28 you will need to upgrade to 26, then 27, then 28.
See the Nextcloud upgrade documentation for tips on upgrading.