[How-To] ownCloud using NGINX, PHP-FPM, and MySQL

ArgaWoW

Patron
Joined
Jul 4, 2015
Messages
444
can you try this out and see if it works?

Code:
mv /usr/local/www/owncloud /usr/local/www/owncloud-bak
fetch "http://download.owncloud.org/community/owncloud-9.0.0.tar.bz2"
tar jxf owncloud-*.tar.bz2 -C /usr/local/www
rm owncloud-*.tar.bz2
cp /usr/local/www/owncloud-bak/config/config.php /usr/local/www/owncloud/config
chown -R www:www /usr/local/www/owncloud

chsh -s /bin/sh www
su www
php /usr/local/www/owncloud/occ upgrade

Hi Josuha,

i have done the Upgrade this morning and it works like a charm. Thanks for your great support.

CU Arga
 

ArgaWoW

Patron
Joined
Jul 4, 2015
Messages
444
OPTIONAL CONFIGURATION

To ask search engine bots not to index your site
Code:
ln -s /usr/local/www/owncloud/robots.txt /usr/local/www


To enable Doc/DocX editing and document previews.
Code:
pkg install libreoffice pecl-imagick


To enable video previews
Code:
pkg install ffmpeg
Hi,

i want to intall libre office and i got this error:


pkg: No packages available to install matching 'libreoffice' have been found in the repositories

thanks for advice

cu
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Hi,

i want to intall libre office and i got this error:


pkg: No packages available to install matching 'libreoffice' have been found in the repositories

thanks for advice

cu
I noticed that too. try libreoffice4
 

Bruce Wilfong

Explorer
Joined
Mar 25, 2016
Messages
85
Any help would be appreciated. I am getting an error message. I fear I FUBAR'd my php-fm.conf file:

On this step:
service nginx start && service php-fpm start && service mysql-server start && service redis start

Message:
Starting php_fpm.
[04-Apr-2016 20:55:41] ERROR: [/usr/local/etc/php-fpm.conf:1] unknown entry 'lis
ten'
[04-Apr-2016 20:55:41] ERROR: failed to load configuration file '/usr/local/etc/
php-fpm.conf'
[04-Apr-2016 20:55:41] ERROR: FPM initialization failed
/usr/local/etc/rc.d/php-fpm: WARNING: failed to start php_fpm

php.ini
1. listen = /var/run/php-fpxm.sock
2. listen.owner = www
3. listen.group = www
4. env[PATH] = /usr/local/bin:/usr/bin:/bin
 
Joined
Dec 2, 2015
Messages
730
It doesn't like line 1 of /usr/local/etc/php-fpm.conf. If you've borked it up too badly, you can copy /usr/local/etc/php-fpm.conf.default and start over.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Any help would be appreciated. I am getting an error message. I fear I FUBAR'd my php-fm.conf file:

On this step:
service nginx start && service php-fpm start && service mysql-server start && service redis start

Message:
Starting php_fpm.
[04-Apr-2016 20:55:41] ERROR: [/usr/local/etc/php-fpm.conf:1] unknown entry 'lis
ten'
[04-Apr-2016 20:55:41] ERROR: failed to load configuration file '/usr/local/etc/
php-fpm.conf'
[04-Apr-2016 20:55:41] ERROR: FPM initialization failed
/usr/local/etc/rc.d/php-fpm: WARNING: failed to start php_fpm

php.ini
1. listen = /var/run/php-fpxm.sock
2. listen.owner = www
3. listen.group = www
4. env[PATH] = /usr/local/bin:/usr/bin:/bin
sounds like you added those line to the beginning of the file instead of finding them in the file and editing/uncommenting them.
 

Bruce Wilfong

Explorer
Joined
Mar 25, 2016
Messages
85
correct, I blew everything away and followed the guide a bit more closely. Everything is working great now, thanks
 

Steven Sedory

Explorer
Joined
Apr 7, 2014
Messages
96
Hi Joshua,

Thanks again for this post. It has been very helpful.

I do have a new issue and I believe it's related to the detailed configuration of your setup...hoping you can identify the issue.

I've followed your instructions to the T (I think) once again, on a newer server, and everything is working great. BUT, when I installed the LDAP app (which also required a 'pkg install php56-ldap'), I cannot login with any of the users from our Active Directory.

All seems well with the LDAP setup, infact, OC even lists all the users from Active Directory in OC's Users. But when I try to login, this is what happens:

1st Attempt:
The web GUI says "An internal error occured. Please try again or contact your administrator," giving me the options to try logging in again. NOTE that it spits back "wrong password" or something similar when I input a non existent user or bad password.

A folder corresponding with the username is created in /mnt/files (my OC data location).

And the OC log says (on one very long line):
{"reqId":"+U3q48acEM00OR\/XvJEK","remoteAddr":"10.20.50.52","app":"handleLogin","message":"Exception: {\"Exception\":\"RedisException\",\"Message\":\"Redis server went away\",\"Code\":0,\"Trace\":\"#0 \\\/usr\\\/local\\\/www\\\/owncloud\\\/lib\\\/private\\\/memcache\\\/redis.php(140): Redis->incrBy('c1147ef7de0fce0...', 1)\\n#1 \\\/usr\\\/local\\\/www\\\/owncloud\\\/lib\\\/private\\\/lock\\\/memcachelockingprovider.php(70): OC\\\\Memcache\\\\Redis->inc('files\\\/bdbed247c...')\\n#2 \\\/usr\\\/local\\\/www\\\/owncloud\\\/lib\\\/private\\\/files\\\/storage\\\/common.php(663): OC\\\\Lock\\\\MemcacheLockingProvider->acquireLock('files\\\/bdbed247c...', 1)\\n#3 \\\/usr\\\/local\\\/www\\\/owncloud\\\/lib\\\/private\\\/files\\\/storage\\\/wrapper\\\/wrapper.php(577): OC\\\\Files\\\\Storage\\\\Common->acquireLock('', 1, Object(OC\\\\Lock\\\\MemcacheLockingProvider))\\n#4 \\\/usr\\\/local\\\/www\\\/owncloud\\\/lib\\\/private\\\/files\\\/storage\\\/wrapper\\\/wrapper.php(577): OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper->acquireLock('', 1, Object(OC\\\\Lock\\\\MemcacheLockingProvider))\\n#5 \\\/usr\\\/local\\\/www\\\/owncloud\\\/lib\\\/private\\\/files\\\/view.php(1854): OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper->acquireLock('', 1, Object(OC\\\\Lock\\\\MemcacheLockingProvider))\\n#6 \\\/usr\\\/local\\\/www\\\/owncloud\\\/lib\\\/private\\\/files\\\/view.php(1956): OC\\\\Files\\\\View->lockPath('\\\/_7086', 1, false)\\n#7 \\\/usr\\\/local\\\/www\\\/owncloud\\\/lib\\\/private\\\/files\\\/view.php(1234): OC\\\\Files\\\\View->lockFile('\\\/_7086', 1)\\n#8 \\\/usr\\\/local\\\/www\\\/owncloud\\\/lib\\\/private\\\/files\\\/view.php(1281): OC\\\\Files\\\\View->getCacheEntry(Object(OCA\\\\Files_Trashbin\\\\Storage), '', '\\\/_7086')\\n#9 \\\/usr\\\/local\\\/www\\\/owncloud\\\/lib\\\/private\\\/files\\\/node\\\/root.php(179): OC\\\\Files\\\\View->getFileInfo('\\\/_7086')\\n#10 \\\/usr\\\/local\\\/www\\\/owncloud\\\/lib\\\/private\\\/files\\\/node\\\/root.php(341): OC\\\\Files\\\\Node\\\\Root->get('\\\/_7086')\\n#11 \\\/usr\\\/local\\\/www\\\/owncloud\\\/lib\\\/private\\\/server.php(742): OC\\\\Files\\\\Node\\\\Root->getUserFolder('_7086')\\n#12 \\\/usr\\\/local\\\/www\\\/owncloud\\\/lib\\\/private\\\/user.php(170): OC\\\\Server->getUserFolder('_7086')\\n#13 \\\/usr\\\/local\\\/www\\\/owncloud\\\/lib\\\/base.php(1082): OC_User::login(*** username and password replaced ***)\\n#14 \\\/usr\\\/local\\\/www\\\/owncloud\\\/lib\\\/base.php(978): OC::tryFormLogin()\\n#15 \\\/usr\\\/local\\\/www\\\/owncloud\\\/lib\\\/base.php(940): OC::handleLogin()\\n#16 \\\/usr\\\/local\\\/www\\\/owncloud\\\/index.php(39): OC::handleRequest()\\n#17 {main}\",\"File\":\"\\\/usr\\\/local\\\/www\\\/owncloud\\\/lib\\\/private\\\/memcache\\\/redis.php\",\"Line\":140}","level":3,"time":"2016-04-14T00:23:39+00:00","method":"POST","url":"\/","user":"_7086"}

2nd Attempt:
No re-login option (until I clear the browser cache), but OC GUI says:
Internal Server Error

The server encountered an internal error and was unable to complete your request.

Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.

More details can be found in the server log.


Technical details
  • Remote Address: 10.20.50.52
  • Request ID: 6XZk+aezaEGqLM7eU3cw
  • Type: OCP\Files\NotFoundException
  • Code: 0
  • Message:
  • File: /usr/local/www/owncloud/lib/private/helper.php
  • Line: 605

Trace
#0 /usr/local/www/owncloud/apps/files/controller/viewcontroller.php(111): OC_Helper::getStorageInfo('/', false)
#1 /usr/local/www/owncloud/apps/files/controller/viewcontroller.php(174): OCA\Files\Controller\ViewController->getStorageInfo()
#2 [internal function]: OCA\Files\Controller\ViewController->index('', '')
#3 /usr/local/www/owncloud/lib/private/appframework/http/dispatcher.php(159): call_user_func_array(Array, Array)
#4 /usr/local/www/owncloud/lib/private/appframework/http/dispatcher.php(89): OC\AppFramework\Http\Dispatcher->executeController(Object(OCA\Files\Controller\ViewController), 'index')
#5 /usr/local/www/owncloud/lib/private/appframework/app.php(110): OC\AppFramework\Http\Dispatcher->dispatch(Object(OCA\Files\Controller\ViewController), 'index')
#6 /usr/local/www/owncloud/lib/private/appframework/routing/routeactionhandler.php(45): OC\AppFramework\App::main('ViewController', 'index', Object(OC\AppFramework\DependencyInjection\DIContainer), Array)
#7 [internal function]: OC\AppFramework\routing\RouteActionHandler->__invoke(Array)
#8 /usr/local/www/owncloud/lib/private/route/router.php(276): call_user_func(Object(OC\AppFramework\routing\RouteActionHandler), Array)
#9 /usr/local/www/owncloud/lib/base.php(882): OC\Route\Router->match('/apps/files/')
#10 /usr/local/www/owncloud/index.php(39): OC::handleRequest()
#11 {main}

And also after this 2nd Attempt, the OC log says (two separate long lines):
{"reqId":"6XZk+aezaEGqLM7eU3cw","remoteAddr":"10.20.50.52","app":"index","message":"Exception: {\"Exception\":\"OCP\\\\Files\\\\NotFoundException\",\"Message\":\"\",\"Code\":0,\"Trace\":\"#0 \\\/usr\\\/local\\\/www\\\/owncloud\\\/apps\\\/files\\\/controller\\\/viewcontroller.php(111): OC_Helper::getStorageInfo('\\\/', false)\\n#1 \\\/usr\\\/local\\\/www\\\/owncloud\\\/apps\\\/files\\\/controller\\\/viewcontroller.php(174): OCA\\\\Files\\\\Controller\\\\ViewController->getStorageInfo()\\n#2 [internal function]: OCA\\\\Files\\\\Controller\\\\ViewController->index('', '')\\n#3 \\\/usr\\\/local\\\/www\\\/owncloud\\\/lib\\\/private\\\/appframework\\\/http\\\/dispatcher.php(159): call_user_func_array(Array, Array)\\n#4 \\\/usr\\\/local\\\/www\\\/owncloud\\\/lib\\\/private\\\/appframework\\\/http\\\/dispatcher.php(89): OC\\\\AppFramework\\\\Http\\\\Dispatcher->executeController(Object(OCA\\\\Files\\\\Controller\\\\ViewController), 'index')\\n#5 \\\/usr\\\/local\\\/www\\\/owncloud\\\/lib\\\/private\\\/appframework\\\/app.php(110): OC\\\\AppFramework\\\\Http\\\\Dispatcher->dispatch(Object(OCA\\\\Files\\\\Controller\\\\ViewController), 'index')\\n#6 \\\/usr\\\/local\\\/www\\\/owncloud\\\/lib\\\/private\\\/appframework\\\/routing\\\/routeactionhandler.php(45): OC\\\\AppFramework\\\\App::main('ViewController', 'index', Object(OC\\\\AppFramework\\\\DependencyInjection\\\\DIContainer), Array)\\n#7 [internal function]: OC\\\\AppFramework\\\\routing\\\\RouteActionHandler->__invoke(Array)\\n#8 \\\/usr\\\/local\\\/www\\\/owncloud\\\/lib\\\/private\\\/route\\\/router.php(276): call_user_func(Object(OC\\\\AppFramework\\\\routing\\\\RouteActionHandler), Array)\\n#9 \\\/usr\\\/local\\\/www\\\/owncloud\\\/lib\\\/base.php(882): OC\\\\Route\\\\Router->match('\\\/apps\\\/files\\\/')\\n#10 \\\/usr\\\/local\\\/www\\\/owncloud\\\/index.php(39): OC::handleRequest()\\n#11 {main}\",\"File\":\"\\\/usr\\\/local\\\/www\\\/owncloud\\\/lib\\\/private\\\/helper.php\",\"Line\":605}","level":3,"time":"2016-04-14T00:26:27+00:00","method":"GET","url":"\/index.php\/apps\/files\/","user":"_7086"}

{"reqId":"xr2wBUtVp7jarzQuH0Qv","remoteAddr":"10.20.50.52","app":"index","message":"Exception: {\"Exception\":\"OCP\\\\Files\\\\NotFoundException\",\"Message\":\"\",\"Code\":0,\"Trace\":\"#0 \\\/usr\\\/local\\\/www\\\/owncloud\\\/apps\\\/files\\\/controller\\\/viewcontroller.php(111): OC_Helper::getStorageInfo('\\\/', false)\\n#1 \\\/usr\\\/local\\\/www\\\/owncloud\\\/apps\\\/files\\\/controller\\\/viewcontroller.php(174): OCA\\\\Files\\\\Controller\\\\ViewController->getStorageInfo()\\n#2 [internal function]: OCA\\\\Files\\\\Controller\\\\ViewController->index('', '')\\n#3 \\\/usr\\\/local\\\/www\\\/owncloud\\\/lib\\\/private\\\/appframework\\\/http\\\/dispatcher.php(159): call_user_func_array(Array, Array)\\n#4 \\\/usr\\\/local\\\/www\\\/owncloud\\\/lib\\\/private\\\/appframework\\\/http\\\/dispatcher.php(89): OC\\\\AppFramework\\\\Http\\\\Dispatcher->executeController(Object(OCA\\\\Files\\\\Controller\\\\ViewController), 'index')\\n#5 \\\/usr\\\/local\\\/www\\\/owncloud\\\/lib\\\/private\\\/appframework\\\/app.php(110): OC\\\\AppFramework\\\\Http\\\\Dispatcher->dispatch(Object(OCA\\\\Files\\\\Controller\\\\ViewController), 'index')\\n#6 \\\/usr\\\/local\\\/www\\\/owncloud\\\/lib\\\/private\\\/appframework\\\/routing\\\/routeactionhandler.php(45): OC\\\\AppFramework\\\\App::main('ViewController', 'index', Object(OC\\\\AppFramework\\\\DependencyInjection\\\\DIContainer), Array)\\n#7 [internal function]: OC\\\\AppFramework\\\\routing\\\\RouteActionHandler->__invoke(Array)\\n#8 \\\/usr\\\/local\\\/www\\\/owncloud\\\/lib\\\/private\\\/route\\\/router.php(276): call_user_func(Object(OC\\\\AppFramework\\\\routing\\\\RouteActionHandler), Array)\\n#9 \\\/usr\\\/local\\\/www\\\/owncloud\\\/lib\\\/base.php(882): OC\\\\Route\\\\Router->match('\\\/apps\\\/files\\\/')\\n#10 \\\/usr\\\/local\\\/www\\\/owncloud\\\/index.php(39): OC::handleRequest()\\n#11 {main}\",\"File\":\"\\\/usr\\\/local\\\/www\\\/owncloud\\\/lib\\\/private\\\/helper.php\",\"Line\":605}","level":3,"time":"2016-04-14T00:26:27+00:00","method":"GET","url":"\/index.php\/apps\/files\/","user":"_7086"}

It seems that this may be related tot he redis server, hence the "{\"Exception\":\"RedisException\",\"Message\":\"Redis server went away.....".

Any ideas? I really appreciate your help.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
those errors are over my head, I'd ask on the OC github/ forum. I don't have any experience with LDAP.

I noticed stuff in your log related to redis, you could try disabling the config.php tweaks I mentioned and see if that works.
 

Steven Sedory

Explorer
Joined
Apr 7, 2014
Messages
96
Thanks. I'll go ahead and try disabling redis and see what happens.

Would that be accomplished by just omitting the following in OC config?

'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
'host' => '/tmp/redis.sock',
'port' => 0,
'timeout' => 0.0,
),
 

Steven Sedory

Explorer
Joined
Apr 7, 2014
Messages
96
Okay...that was how to disable it. And disabling it fixed my problem!

That leads to the obvious question of: what are the advantages of Redis that I will be loosing out on now? And since that was the issue, is there maybe an easy way to make it work with LDAP? I know you said that was over your head, but could the port=0 setting (disabling it from the TCP stack) possibly be it, as maybe LDAP is trying to talk to the Redis server directly?
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
redis is used for file locking, which is faster then storing the locks in the database
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
like I said I don't know anything about LDAP =\
 

Steven Sedory

Explorer
Joined
Apr 7, 2014
Messages
96
For the record, I was able to get my setup to work with Redis by using the TCP stack instead of a socks file. Had to remove the "port 0" from the redis config.

'memcache.local' => '\OC\Memcache\Redis',
'redis' => array(
'host' => 'localhost',
'port' => 6379,
),

THEN I dug deeper, and found out that when I set unixsocketperm 766 instead of 700 in redis.conf, using the socks file and port 0 (the better way according to https://doc.owncloud.org/server/8.1/admin_manual/configuration_server/caching_configuration.html), I could get it to work!

I don't think this will be a security issue, but if you think it is, please let me know.

I also set 'memcache.locking' => '\OC\Memcache\Redis', instead of APCu per the URL above.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
nice, thanks for update!
 

rodofrn

Contributor
Joined
Apr 13, 2016
Messages
180
Hi Joshua, nice guide.!! But I cant access the owncloud webGUI. When I try to acces it i get: 404 NOT FOUND and nginx/1.8.1.
What is going on? Can you help me? Thanks..! Also, I have to make 2 jails right? and do all the changes and lines in the "db" one right? Also, the file /var/db/mysql/my.cnf did not exist, so i created it. is that right? Thanks again.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Hi Joshua, nice guide.!! But I cant access the owncloud webGUI. When I try to acces it i get: 404 NOT FOUND and nginx/1.8.1.
What is going on? Can you help me? Thanks..! Also, I have to make 2 jails right? and do all the changes and lines in the "db" one right? Also, the file /var/db/mysql/my.cnf did not exist, so i created it. is that right? Thanks again.
are you adding /owncloud to the URL?
you don't need 2 jails, but I recommend 2 datasets mounted into your jail for your files, and database.
yup create that config file.
 

rodofrn

Contributor
Joined
Apr 13, 2016
Messages
180
Yeah, I made sure to add /owncloud to the end of the jail ip. ok ill remove the other jail then, and add both datasets to the same jail. any other ideas? could it be that the jail didnt have both datasets?
 
Top