The nextcloud plugin is available again in the plugins section. I wanted to share my experience when installing it here.
System: FreeNAS-11.2-RC1 (Build Date: Oct 17, 2018 23:38)
After hitting the install Button next to the plugin, the jail is created. MySQL database admin user dbadmin and password are printed out in the popup window. The default hostname is nextcloud and the nextcloud setup page becomes available on http://nextcloud in your local network.
Unfortunately it is not installing the nextcloud database and user automatically. So we need to do this via command line and input those values on the web frontend. This is definitely better done in the script from @danb35 or in the nextcloud docker-compose container setup.
To do this via command line, enter mysql prompt by executing
There is no nextcloud database installed. Check this by entering
To add the database, user and password, use the following commands:
Write down your credentials and input them to the web configuration ui.
I also decided to add some mountpoints for the jail:
This lets me keep data and config outside of the jail. The backup folder stores current mysql database backups.
I did not create mountpoint for the database, but in case anyone wants to keep the database data outside of the jail, the location of the files are the following:
I have an installation, where I adjusted the blocksize of the underlying innodb to match with the zfs dataset but I will skip that here. I can not say, if it gives better performance. If anyone is interested, I could try.
You will also have to move the initial data and config content over to mount directories and delete the corresponding directories in /usr/local/www/nextcloud
After the installation succeeds, there are some errors in the admin section:
There seems to be some misconfiguration in the jail: The file /usr/local/etc/php-fpm.conf has a section that tries to fix the error, but the introduced changes there only apply to the generic www section.
nextcloud related configuration is done in php-fpm.d/nextcloud.conf, so we need to copy the uncommented part over to this file.
after that, restart php and the error should disappear.
I tested if the webserver now sees the PATH variable by adding phptest.php to my webroot which only prints out the var:
Next Error was due for enabling the opcache in the php.ini.
The php.ini can be located by adding to the file above. It will point to /usr/local/etc/php.ini. Here are some commented lines which need to get activated according to the settings recommended by nextcloud. Also checkif opcache is enabled by viewing /usr/local/etc/php/ext-10-opcache.ini which should say .
Next error is due to the nginx configuration:
nginx configuration is located at /usr/local/etc/nginx/conf.d/nextcloud.conf and the recommended settings for nextcloud are here.
To target the above error, we basically would only care about adding
But(!) since the file in the jail highly differs from the recommended settings, has gzip deactivated and also seemed a bit old, I copied the currently recommended settings over and changed them to match and .
Also the upstream redirection has to be changed to redirect to the correct unix socket:
I am running a nginx reverse proxy which handles my TLS certificates so I removed the ssl related parts and only listen on port 80. Installing certbot would be next, if you want to do the certificate handling directly within this jail.
restart and test the nginx server using
I'm not sure if those changes get reverted if the plugin is updated, So I am thinking of adding additional mount points for my changes in /usr/local/etc/nginx/conf.d. Also I was wondering if anyone else ran into these issues with the plugin.
System: FreeNAS-11.2-RC1 (Build Date: Oct 17, 2018 23:38)
After hitting the install Button next to the plugin, the jail is created. MySQL database admin user dbadmin and password are printed out in the popup window. The default hostname is nextcloud and the nextcloud setup page becomes available on http://nextcloud in your local network.
Unfortunately it is not installing the nextcloud database and user automatically. So we need to do this via command line and input those values on the web frontend. This is definitely better done in the script from @danb35 or in the nextcloud docker-compose container setup.
To do this via command line, enter mysql prompt by executing
Code:
root@nextcloud:/ # mysql -udbadmin -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.6.42 Source distribution Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
There is no nextcloud database installed. Check this by entering
Code:
mysql> show databases -> ; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | test | +--------------------+ 4 rows in set (0.00 sec)
To add the database, user and password, use the following commands:
Code:
CREATE DATABASE nextcloud; CREATE USER 'nextcloud'@'localhost' IDENTIFIED BY 'thisisyourpassword'; GRANT USAGE on nextcloud.* to 'nextcloud'@'localhost'; GRANT ALL PRIVILEGES on nextcloud.* to 'nextcloud'@'localhost';
Write down your credentials and input them to the web configuration ui.
I also decided to add some mountpoints for the jail:
This lets me keep data and config outside of the jail. The backup folder stores current mysql database backups.
I did not create mountpoint for the database, but in case anyone wants to keep the database data outside of the jail, the location of the files are the following:
- config is at /usr/local/etc/mysql/conf.d and the
- data is at /var/db/mysql
- The my.cnf is at /usr/local/my.cnf, so the directory is probably /usr/local/my.cnf.d/
I have an installation, where I adjusted the blocksize of the underlying innodb to match with the zfs dataset but I will skip that here. I can not say, if it gives better performance. If anyone is interested, I could try.
You will also have to move the initial data and config content over to mount directories and delete the corresponding directories in /usr/local/www/nextcloud
After the installation succeeds, there are some errors in the admin section:
Code:
PHP does not seem to be setup properly to query system environment variables. The test with getenv("PATH") only returns an empty response. Please check the installation documentation ↗ for PHP configuration notes and the PHP configuration of your server, especially when using php-fpm.
There seems to be some misconfiguration in the jail: The file /usr/local/etc/php-fpm.conf has a section that tries to fix the error, but the introduced changes there only apply to the generic www section.
Code:
[www] ... ;env[HOSTNAME] = $HOSTNAME ;env[PATH] = /usr/local/bin:/usr/bin:/bin ;env[TMP] = /tmp ;env[TMPDIR] = /tmp ;env[TEMP] = /tmp env[HOSTNAME] = $HOSTNAME env[PATH] = /bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin env[TMP] = /tmp env[TMPDIR] = /tmp env[TEMP] = /tmp
nextcloud related configuration is done in php-fpm.d/nextcloud.conf, so we need to copy the uncommented part over to this file.
Code:
[nextcloud] ... env[HOSTNAME] = $HOSTNAME env[PATH] = /bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin env[TMP] = /tmp env[TMPDIR] = /tmp env[TEMP] = /tmp
after that, restart php and the error should disappear.
Code:
/usr/local/etc/rc.d/php-fpm restart
I tested if the webserver now sees the PATH variable by adding phptest.php to my webroot which only prints out the var:
Code:
<?php getenv("PATH");?>
Next Error was due for enabling the opcache in the php.ini.
The php.ini can be located by adding
Code:
phpinfo();
Code:
zend_extension=opcache.so
Next error is due to the nginx configuration:
Code:
The "Referrer-Policy" HTTP header is not set to "no-referrer", "no-referrer-when-downgrade", "strict-origin" or "strict-origin-when-cross-origin". This can leak referer information. See the W3C Recommendation ↗.
nginx configuration is located at /usr/local/etc/nginx/conf.d/nextcloud.conf and the recommended settings for nextcloud are here.
To target the above error, we basically would only care about adding
Code:
add_header Referrer-Policy no-referrer;
But(!) since the file in the jail highly differs from the recommended settings, has gzip deactivated and also seemed a bit old, I copied the currently recommended settings over and changed them to match
Code:
server_name _;
Code:
root /usr/local/www/nextcloud
Also the upstream redirection has to be changed to redirect to the correct unix socket:
Code:
upstream php-handler { server unix:/var/run/nextcloud-php-fpm.sock; }
I am running a nginx reverse proxy which handles my TLS certificates so I removed the ssl related parts and only listen on port 80. Installing certbot would be next, if you want to do the certificate handling directly within this jail.
restart and test the nginx server using
Code:
root@nextcloud:/usr/local/etc/nginx/conf.d # /usr/local/etc/rc.d/nginx restart Performing sanity check on nginx configuration: nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful Stopping nginx. Waiting for PIDS: 81103. Performing sanity check on nginx configuration: nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful Starting nginx.
I'm not sure if those changes get reverted if the plugin is updated, So I am thinking of adding additional mount points for my changes in /usr/local/etc/nginx/conf.d. Also I was wondering if anyone else ran into these issues with the plugin.