NextCloud : How to fix Strict Transport Security (HSTS) and Memory Cache


Do you use NextCloud and see bellow notification?

No memory cache has been configured and The “Strict Transport Security” HTTP header is not configured warning messages.

Here is how to fix HSTS issue

1. Open you domain configuration on Apache add this following line after ServerName

Header always add Strict-Transport-Security "max-age=15768000; includeSubDomains; preload"

2. Enable module header

a2enmod headers

3. Restart the apache

sudo service apache2 restart

Here is how to fix Memory Cache

1. Install php-apcu

apt-get install php-apcu php-apcu-bc

2. Navigate and edit NextCloud config, add this following config

'memcache.local' => '\OC\Memcache\APCu',

3. Save and restart apache

sudo service apache2 restart

All notification should be gone now. Have fun..
Thank you.