NextCloud Hosting in AlibabaCloud(ECS+OSS+RDS+Redis)

NextCloud Hosting in AlibabaCloud(ECS+OSS+RDS+Redis)

Official Guideline

  • Ubuntu 16.04
  • NextCloud 13

Server Application

sudo apt update
sudo apt upgrade
sudo apt install apache2 php libapache2-mod-php7.0
apt install php7.0-gd php7.0-json php7.0-mysql php7.0-curl php7.0-mbstring
apt install php7.0-intl php7.0-mcrypt php-imagick php7.0-xml php7.0-zip

Site conf


SSL

Let's Encrypt

RDS

setup through the backend of AlibabaCloud

OSS

Latest Release

wget your_ossfs_package

sudo apt update
sudo apt install gdebi-core
sudo gdebi your_ossfs_package

echo my-bucket:access-key-id:access-key-secret  > /etc/passwd-ossfs
chmod 640 /etc/passwd-ossfs
mkdir /tmp/ossfs
ossfs my-bucket /tmp/ossfs -ourl=http://oss-cn-hangzhou.aliyuncs.com -ouid=1001 -ogid=1001 -oumask=007 -o allow_other

ouid(user id) and ogid(groud id)

id -u www-data
id -g www-data

Before Starting the Installation

chown -R www-data:www-data /var/www/nextcloud/

Caching with Redis

sudo apt install redis-server php-redis
sudo service apache2 restart

/var/www/nextcloud/config/config.php

'memcache.local' => '\OC\Memcache\Redis',
'redis' => array(
     'host' => 'localhost',
     'port' => 6379,
      ),
'memcache.locking' => '\OC\Memcache\Redis',

"Strict-Transport-Security"

/etc/apache2/site-available/nextcloud.conf

<IfModule mod_headers.c>
          Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
</IfModule>

OPcache

/etc/php/7.0/apache2/php.ini

opcache.enable=1
opcache.enable_cli=1
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.memory_consumption=128
opcache.save_comments=1
opcache.revalidate_freq=1

Config File Summary

apache2: /etc/apache2/site-available/site.conf
php: /etc/php/7.0/apache2/php.ini
NextCloud config: /var/www/nextcloud/config/config.php

Tunning

Email

Logging

Default Files/Folders

'skeletondirectory' => '',

Default App Folder

'apps_paths' => array(
    array(
        'path'=> '/var/www/nextcloud/data/apps',
        'url' => '/apps',
        'writable' => true,
    ),
),

Pretty URLs

'overwrite.cli.url' => 'https://example.org',
'htaccess.RewriteBase' => '/',

update .htaccess file

sudo -u www-data php /var/www/nextcloud/occ maintenance:update:htaccess