Hi @Jchild25,
there are many tutorials to install nextcloud using a domain name.
there are many types of installation of nextcloud: docker, snap or using “packages ( folder )”.
In my case, I use “packages” with apache2
link to the official doc: Installation and server configuration — Nextcloud latest Administration Manual latest documentation
my steps to install nextcloud on ubuntu 20.04 :
Installation of requirement :
-
sudo apt install apache2 mariadb-server -
sudo apt-get install php zip libapache2-mod-php php-gd php-json php-mysql php-curl php-mbstring php-intl php-imagick php-xml php-zip php-mysql php-bcmath php-gmp php-apcu -y -
sudo mysql_secure_installation
Enter current password for root (enter for none): Just press the Enter
Set root password? [Y/n]: Y
New password: Enter your password
Re-enter new password: Repeat your password
Remove anonymous users? [Y/n]: Y
Disallow root login remotely? [Y/n]: Y
Remove test database and access to it? [Y/n]: Y
Reload privilege tables now? [Y/n]: Y -
sudo mysql -u root -p -
CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; -
CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'user_password_here'; -
GRANT ALL ON nextcloud.* TO 'nextclouduser'@'localhost' IDENTIFIED BY 'user_password_here' WITH GRANT OPTION; -
FLUSH PRIVILEGES; -
EXIT;
/!\ for more security , replace nextcloud │ nextclouduser│user_password_here
Download of nextcloud
wget https://download.nextcloud.com/server/releases/nextcloud-21.0.0.zipunzip nextcloud-21.0.0.zipsudo mv nextcloud /var/www/nextcloud/sudo chown -R www-data:www-data /var/www/nextcloud/sudo chmod -R 750 /var/www/nextcloud/
Setting up apache
sudo nano /etc/apache2/sites-available/domain.conf( Changedomainby what you want )
<VirtualHost *:80>
DocumentRoot /var/www/nextcloud/
ServerName example.com
Alias /nextcloud "/var/www/nextcloud/"
<Directory /var/www/nextcloud/>
Options +FollowSymlinks
AllowOverride All
Require all granted
<IfModule mod_dav.c>
Dav off
</IfModule>
SetEnv HOME /var/www/nextcloud
SetEnv HTTP_HOME /var/www/nextcloud
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Replace example.conf by your domain name
If you want to acces to nextcloud by using only domain.com ( not domain.com/nextcloud/) just delete Alias /nextcloud "/var/www/nextcloud/"
- ctrl+s
- ctrl+x
sudo a2ensite domain.confsudo a2enmod rewritesudo a2enmod envsudo a2enmod dirsudo a2enmod mimesudo systemctl restart apache2
you can access to the wizard installation of nextcloud on your local ip
-
create an admin account
-
set the path of your data directory ( where the data of users are stored ) this directory need to be available by www-data user with full access:
sudo chown -R www-data:www-data /PathDirectory
sudo chmod -R 750 /PathDirectory -
Enter your user database ( in this tutorial , it is
nextclouduser) -
Enter your password user ( in this tutorial , it is
user_password_here) -
Enter your database name ( in this tutorial , it is
nextcloud)
launch the installation
Add your domain to trusted domain
sudo nano /var/www/nextcloud/config/config.php- inside trusted domain add :
1=> ' domain.com '
Enable ssl ( https connection ) using certbot ( need to open your router port and don’t forget to setup a firewall like ufw or other )
-
sudo apt-get install certbot python3-certbot-apache -
sudo certbot --apache -
Enter your mail address , agree the term, select you domain and redirect all traffic to https
-
sudo nano /etc/apache2/sites-available/domain-le-ssl.conf -
add this line before the last
</VirtualHost>:
Header always set Strict-Transport-Security “max-age=15552000; includeSubDomains”
Enable Redis Memcache
sudo apt-get install redis-server php-redissudo nano /var/www/nextcloud/config/config.php- add these lines before the last
);:
‘memcache.local’ => ‘\OC\Memcache\Redis’,
‘memcache.locking’ => ‘\OC\Memcache\Redis’,
‘memcache.distributed’ => ‘\OC\Memcache\Redis’,
‘redis’ =>
array (
‘host’ => ‘localhost’,
‘port’ => 6379,
),
PHP memory limit and opcache:
sudo nano /etc/php/7.4/apache2/php.ini- ctrl+w
- memory
- set
memory_limiteto512 M - find the lines and set the values :
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
PHP fpm :
sudo apt-get install php-fpmsudo a2enmod proxy_fcgi setenvifsudo a2enconf php7.4-fpmsystemctl restart apache2sudo nano /etc/php/7.4/fpm/pool.d/www.conf- find the lines and set the values :
pm.max_children = 120
pm.start_servers = 12
pm.min_spare_servers = 6
pm.max_spare_servers = 18
link to nextcloud doc for tunning ( Redis / opcache / php fpm / SSL) : Server tuning — Nextcloud latest Administration Manual latest documentation