apt install php8.2 libapache2-mod-php8.2 php8.2-cli
apt install php8.2-curl php8.2-xml php-gd php-mbstring php-zip php-pgsql php-bz2 php-intl php8.2-bcmath php-fpm php-imagick php-gmp php-apcu php-ldap
/dev/vdb1 /opt/nextcloud xfs defaults 0 0
wget https://download.nextcloud.com/server/releases/latest.zip
chown -R www-data:www-data /opt/nextcloud/www
create database nextcloud;
alter user nextcloud password 'xxx';
alter database nextcloud OWNER TO nextcloud;
vi /etc/apache2/sites-available/nextcloud.conf
Alias /nextcloud "/opt/nextcloud/www"
<Directory /opt/nextcloud/www>
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews
<IfModule mod_dav.c>
Dav off
</IfModule>
</Directory>
a2enmod rewrite
a2enmod remoteip
a2enmod proxy_fcgi
a2enconf php8.2-fpm
a2enmod headers
a2enmod env
a2enmod dir
a2enmod mime
a2enmod setenvif
vi /etc/php/8.2/apache2/php.ini
apt install certbot python3-certbot-apache
certbot --apache -d server.example.com
a2enmod ssl
a2ensite default-ssl
service apache2 reload
vi /etc/apache2/sites-enabled/000-default.conf
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
vi /etc/apache2/sites-available/000-default-le-ssl.conf
...
ServerAdmin admin@aprilsoftware.com
DocumentRoot /opt/nextcloud/www
...
<IfModule mod_headers.c>
Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
</IfModule>
RemoteIPProxyProtocol On
...
</VirtualHost>
<Directory /opt/nextcloud/www>
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews
<IfModule mod_dav.c>
Dav off
</IfModule>
</Directory>
</IfModule>
rm /etc/apache2/sites-available/nextcloud.conf
systemctl restart php8.2-fpm
vi /etc/php/8.2/cli/php.ini
sudo -u www-data php occ maintenance:mode --on
mkdir /opt/nextcloud/pg_nextcloud
chown postgres:postgres pg_nextcloud
create tablespace ts_nextcloud location '/opt/nextcloud/ts_nextcloud';
alter database nextcloud set tablespace ts_nextcloud;
vi /opt/nextcloud/www/lib/private/Installer.php
timeout -> 500 instead of 120
(&(|(objectclass=person))(|(|(memberof=CN=Nextcloud Users,CN=Users,DC=example,DC=com)(primaryGroupID=1111))))
(&(&(|(objectclass=person)))(samaccountname=%uid))
pg_dump nextcloud -h localhost -U postgres -f nextcloud-sqlbkp_`date +"%Y%m%d"`.bak
drop database nextcloud;
create database nextcloud;
alter database nextcloud OWNER TO nextcloud;
\q
psql -d nextcloud -f nextcloud-sqlbkp.bak
vi /etc/php/8.2/mods-available/apcu.ini
systemctl restart php8.2-fpm
sudo -u www-data php /opt/nextcloud/www/updater/updater.phar