Nextcloud configs & error fixes
Last edited on 12/6/2021
I used a combination of commands from https://landchad.net/nextcloud (if installing in subdirectory/subfolder) and https://www.howtoforge.com/tutorial/ubuntu-nginx-nextcloud/ (mostly the latter if you're installing in a subdomain or in webroot).
Keep in mind I am an absolute moron when it comes to server stuff and it took finding the HowToForge guide to install into a subdomain because the LandChad tutorial resulted in the URL https://cloud.mydomain.com/nextcloud which was not what I wanted. Right now I'm struggling to install a CMS because my monkey brain can't process how to install it in a webroot, but regardless, my Nextcloud setup warnings (accessed in https://cloud.mydomain.com/settings/admin/overview) forced me to compile this guide to fix the errors it gave me.
I used Nginx as my web server, and installed Nextcloud in a subdomain. My config was modified from the HowToForge tutorial above.
Error-fixing
To fix Strict-Transport-Security error:
Access your Nextcloud config atsudo nano /etc/nginx/sites-available/nextcloud
Find and uncomment (remove the '#') in:#add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;" always;
Save, then run:sudo nano nginx -t
to check for errors. If it returns OK and successful, run the command below to restart Nginx.
sudo systemctl restart nginx
To fix "The PHP memory limit is below the recommended value of 512MB"
Access php.ini (php config) insudo nano etc/php/7.4/fpm/php.ini
CTRL+W the term memory_limit
. Once you find it, change the value so that you have:
memory_limit = 512M
Save then restart php. Since my php version was 7.4, this was the command I used:
sudo systemctl restart php7.4-fpm
To fix "Your web server is not properly set up to resolve "/.well-known/..."
So if you access the documentation at https://docs.nextcloud.com/server/23/admin_manual/issues/general_troubleshooting.html#service-discovery-label, Nextcloud points Nginx users to https://docs.nextcloud.com/server/23/admin_manual/installation/nginx.html. Skimming through the document, we see a fix that I'm going to replicate here.
If you were following the HowToForge tutorial, they have this under carddav and caldav:return 301 $scheme://$host:$server_port/remote.php/dav;
We'll apply the fix stated in the Nextcloud Nginx configuration page:location = /.well-known/carddav { return 301 /remote.php/dav/; }
location = /.well-known/caldav { return 301 /remote.php/dav/; }
Oops, it didn't werk. Searching the web brings up this page (https://www.reddit.com/r/NextCloud/comments/mbq9hm/your_web_server_is_not_properly_set_up_to_resolve/) and what worked was this fix:location ^~ /.well-known {
location = /.well-known/carddav { return 301 $scheme://$host/remote.php/dav; }
location = /.well-known/caldav { return 301 $scheme://$host/remote.php/dav; }
location ^~ /.well-known { return 301 $scheme://$host/index.php$uri; }
try_files $uri $uri/ =404;
}
Phone region error
Okay, so this was a great help: https://help.nextcloud.com/t/unavoidable-security-setup-warnings-with-nc-21-update/108667/2
sudo nano /var/www/nextcloud/config/config.php
Scroll to the last entry ('installed' => true,
in my case), then press ENTER right after TRUE
for a new line, then add:'default_phone_region' => '<country code>',
Save.
"No memory cache has been configured"
In this https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/security_setup_warnings.html, Nextcloud says "You are not required to use any caches, but caches improve server performance."
Checking their Memory Caching page (https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/caching_configuration.html), Nextcloud has this statement in bold: "A memcache is not required and you may safely ignore the warning if you prefer.". Yes. YES. I'll ignore the warning because I'm too stupid to follow the instructions, thanks.
php-imagick has no SVG support
Here:sudo apt-get install libmagickcore-6.q16-6-extra -y
Other notes
This is my first experience installing an application on a VPS and so I have practically no server experience prior to that (unless you count Samba sharing on a headless Raspberry Pi in a pathetic attempt to try out a NAS), so if you ask me for clarification I can't answer anything else other than "use your preferred search engine." I've tried to replicate what I did in the terminal, down to adding sudo
before the commands. I hope this document helps.