Nextcloud - debian
Добавлено: 04 мар 2024, 14:34
Код: Выделить всё
# apt install apache2 php php-curl php-cli php-mysql php-gd php-common php-xml php-json php-intl php-pear php-imagick php-dev php-common php-mbstring php-zip php-soap php-bz2 php-bcmath php-gmp php-apcu libmagickcore-dev php-redis php-memcached ufw mc htop neofetch sudo mariadb-server curl certbot python3-certbot-apache
Код: Выделить всё
# sudo usermod -aG sudo [username]
Код: Выделить всё
# groups vboxuser
Код: Выделить всё
$ sudo nano /etc/php/8.2/apache2/php.ini
#Increase the default value of parameters memory_limit, upload_max_filesize, post_max_size, and max_execution_time. Change the value as you need.
post_max_size = 20G
upload_max_filesize = 25G
max_file_uploads = 200
max_input_time = 3600
max_execution_time = 3600
session.gc_maxlifetime = 3600
memory_limit = 512M
#Enable file_uploads and allow_url_fopen by changing the default value to On.
file_uploads = On
allow_url_fopen = On
#Disable the parameter display_errors and output_buffering by changing the default value to Off.
display_errors = Off
output_buffering = Off
#Uncomment the zend_extension parameter and change the value to opcache. This will enable PHP OPcache, which is needed for Nextcloud.
zend_extension=opcache
#Add the following lines to the [opcache] section. The OPCache configuration is recommended by Nextcloud.
opcache.enable = 1
opcache.interned_strings_buffer = 8
opcache.max_accelerated_files = 10000
opcache.memory_consumption = 128
opcache.save_comments = 1
opcache.revalidate_freq = 1
#Save the file and close the editor when finished.
Код: Выделить всё
$ sudo nano /etc/php/8.2/mods-available/apcu.ini
apc.enable_cli=1
Код: Выделить всё
$ sudo systemctl is-enabled mariadb
Код: Выделить всё
$ sudo systemctl status mariadb
Код: Выделить всё
$ sudo mariadb-secure-installation
Код: Выделить всё
$ sudo mariadb -u root -p
show tablesCREATE DATABASE nextcloud_db;
CREATE USER nextclouduser@localhost IDENTIFIED BY 'StrongPassword';
GRANT ALL PRIVILEGES ON nextcloud_db.* TO nextclouduser@localhost;
FLUSH PRIVILEGES;
SHOW GRANTS FOR nextclouduser@localhost;
________________________________________
SELECT User FROM mysql.user;
show databases;
DROP DATABASE ejabberd_base;
Код: Выделить всё
mariadb-show db_name
Код: Выделить всё
$ cd /var/www/
Код: Выделить всё
$ sudo curl -o nextcloud.zip https://download.nextcloud.com/server/releases/latest.zip
Код: Выделить всё
$ sudo unzip nextcloud.zip
Код: Выделить всё
$ sudo chown -R www-data:www-data nextcloud
Код: Выделить всё
$ sudo systemctl is-enabled apache2
Код: Выделить всё
$ sudo systemctl status apache2
Код: Выделить всё
$ sudo ufw allow OpenSSH
Код: Выделить всё
$ sudo ufw enable
Код: Выделить всё
$ sudo ufw allow "WWW Full"
Код: Выделить всё
$ sudo ufw status
Код: Выделить всё
$ sudo crontab -u www-data -e
*/5 * * * * php -f /var/www/nextcloud/cron.php
Код: Выделить всё
$ sudo crontab -u www-data -l
Код: Выделить всё
sudo nano /etc/apache2/sites-available/nextcloud.conf
<VirtualHost *:80>
ServerName nextcloud.hwdomain.io
DocumentRoot /var/www/nextcloud/
# log files
ErrorLog /var/log/apache2/files.hwdomain.io-error.log
CustomLog /var/log/apache2/files.hwdomain.io-access.log combined
<Directory /var/www/nextcloud/>
Options +FollowSymlinks
AllowOverride All
<IfModule mod_dav.c>
Dav off
</IfModule>
SetEnv HOME /var/www/nextcloud
SetEnv HTTP_HOME /var/www/nextcloud
</Directory>
</VirtualHost>
Код: Выделить всё
$ a2enmod rewrite
$ a2enmod headers
$ a2enmod env
$ a2enmod dir
$ a2enmod mime
Код: Выделить всё
$ sudo a2ensite nextcloud.conf
Код: Выделить всё
$ sudo apachectl configtest
Код: Выделить всё
$ sudo systemctl restart apache2
Код: Выделить всё
$ sudo certbot --apache --agree-tos --redirect --hsts --staple-ocsp --email user@hwdomain.io -d nextcloud.hwdomain.io
Код: Выделить всё
$ sudo nano /var/www/nextcloud/config/config.php
add:
<?php
$CONFIG = array (
....
# Additional configuration
'memcache.local' => '\OC\Memcache\APCu',
);
Код: Выделить всё
$ sudo systemctl restart apache2