Modify the php.ini settings, older PHP 5 system based on Nextcloud recommendation. Make sure, you have to take a backup of php.ini file before modification for best practice.
[older (PHP5) systems]
$ sudo cp /etc/php5/apache2/php.ini /etc/php5/apache2/php.ini.bk
$ sudo sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php5/apache2/php.ini
$ sudo sed -i "s/;date.timezone.*/date.timezone = Asia/Kolkata/" /etc/php5/apache2/php.ini
$ sudo sed -i "s/upload_max_filesize = .*/upload_max_filesize = 200M/" /etc/php5/apache2/php.ini
$ sudo sed -i "s/post_max_size = .*/post_max_size = 200M/" /etc/php5/apache2/php.ini
Configure MariaDB database for Nextcloud
For Production environment, Nextcloud strongly recommended to use MariaDB to get the best performance. Follow the below steps to create the MariaDB Database with required details such as (DB Name, DB User Name, DB password).
In my case DB Name : nextcloud_db
, DB User : nextcloud_user
& Password : 12345
. I advise users to set hard and guess password.
$ sudo mysql -u root -p Enter password: ****** MariaDB [(none)]> create database nextcloud_db; Query OK, 1 row affected (0.01 sec) MariaDB [(none)]> GRANT ALL PRIVILEGES ON nextcloud_db.* TO 'nextcloud_user'@'localhost' IDENTIFIED BY '12345'; Query OK, 0 rows affected (0.01 sec) MariaDB [(none)]> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> exit Bye
Download Nextcloud archive file
Visit Nextcloud download page and grep the latest release.
$ cd /tmp $ wget https://download.nextcloud.com/server/releases/nextcloud-10.0.0.tar.bz2 $ tar -xjvf nextcloud-10.0.0.tar.bz2 $ mv nextcloud /var/www/ $ sudo chown -R www-data:www-data /var/www/nextcloud/
Apache virtualhost Configuration
Create a new virtual host file called nextcloud.conf and add the below contents. Replace the Directory and other filepaths /var/www/nextcloud/
with your own.
$ sudo /etc/apache2/sites-available/nextcloud.conf Alias /nextcloud "/var/www/nextcloud/" <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>
Thank you for your detailed manual.
How to use https://… instead of http://…? I.e., how to add SSL option here?
And I’d like to open site like https://my_domain_name/ instead of https://my_domain_name/nextcloud. What do I need to change in Apache config file?
Keep nextcloud files in domain home directory instead of sub directory to access http://www.mydomain.com
If you want to enable self-signed certificate, just use following commands for Ubuntu based systems.
a2enmod ssl
a2ensite default-ssl
service apache2 reload
Thank you.