Installing Nextcloud
apt install apache2 mariadb-server libapache2-mod-php php-gd php-mysql php-curl php-mbstring php-intl php-gmp php-bcmath php-xml php-imagick php-zip unzip -y
wget [https://download.nextcloud.com/server/releases/latest.zip](https://download.nextcloud.com/server/releases/latest.zip)
unzip latest.zip
sudo -u www-data cp -r ./nextcloud/* /var/www/html
chown -R www-data:www-data /var/www/htmlPretty URLs
nano /var/www/html/config/config.php
...
'overwrite.cli.url' => 'https://sub.domain.com',
'htaccess.RewriteBase' => '/',
...sudo -u www-data php ./occ maintenance:update:htaccess
Fixes
INFO
You may have to change the PHP version in the file names based on your setup. At the time of writing, I was using PHP 8.1.
The PHP memory limit is below the recommended value of 512MB
nano /etc/php/8.1/apache2/php.iniFind:memory_limit = 128MReplace with:memory_limit = 512M
Fix "PHP configuration option output_buffering must be disabled"
nano /etc/php/8.1/apache2/php.iniFind:output_buffering = 4096Replace with:output_buffering = Off
❗️ Fix “PHP configuration option output_buffering must be disabled”
nano /etc/php/8.1/apache2/php.ini
Find: output_buffering = 4096
Replace with: output_buffering = Off
❗️ Fix “Your data directory and files are probably accessible from the internet. The .htaccess file is not working. It is strongly recommended that you configure your web server so that the data directory is no longer accessible, or move the data directory outside the web server document root.”
nano /etc/apache2/apache2.conf
Find:
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>Replace:
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>systemctl restart apache2