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

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
I did not allocate space outside the jail in the normal way and I guess following your steps will then not work. I did this for security reasons as I use the system not only for private stuff but also for work and I did think it would be better to have the data reside only inside the Jail and not on the mopre general FreeNaS main system. I did this a long time ago and forgot to think about it when I did the upgrade ... STUPID In hinsight I think your way is better.

Perhaps the system is already working as errors have to be expected when I try to download a file from the web interfacethat that is not there ...

I will try to do as you suggest. I will take some time as there is a lot of data.

I do not understand the error messages and how they link to the lack of data though?

Perhaps I will reinstal everything from scratch..
ahh, well I assume you did not know there is no security benefit to having the data inside the jail. any process on the host can see the files whether in the jail or not (though doesn't necessarily have permission to read/write to them).

OK, you should be able to recover as long as you still have your 'data' directory, config.php, and the mysql database (in /var/db/mysql). That is all that is unique to a owncloud instance.

I'm not sure about those error messages. What is really weird is how they refrence owncloud-bak. I don't understand either how it even knows about that folder.
 

Elo

Contributor
Joined
Mar 11, 2012
Messages
122
Hi again Joshua. It works ok now, there are some problems with missing files due to conflicts but I am able to open files on the server and to download /if they exsist :smile: ) .I did a fresh instal in a new jail after your procedure. I have one question: As I open Owncloud the first time from the web and fill in the data in order to finalize the instalation I get the error: Can not establish or write in data directory /mnt/files. The owner is www:www. For mnt the owner is root:wheel. For both the permissions are drwxr-xr-x (I have also tried with 777) ... I guess it is a matter of wrong permissions for the user I log in the first time (system says it will create a admin user so the user I use is new!) . Any suggestions?
 
Last edited:

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
It should be writable.
Can you confirm by showing the output of 'ls -l /mnt' and 'ls -l /mnt/files'
 

Elo

Contributor
Joined
Mar 11, 2012
Messages
122
It seems it is not:
root@Owncloudjail:/ # ls -l /mnt
total 1
drwxrwxrwx 2 www www 2 Apr 26 04:33 files
root@Owncloudjail:/ # ls -l /mnt/files
total 0

and

root@Owncloudjail:/ # ls -la /mnt
total 10
drwxrwxrwx 3 root wheel 3 Apr 26 04:35 .
drwxr-xr-x 17 root wheel 21 Dec 29 21:13 ..
drwxrwxrwx 2 www www 2 Apr 26 04:33 files
root@Owncloudjail:/ # ls -la /mnt/files
total 1
drwxrwxrwx 2 www www 2 Apr 26 04:33 .
drwxrwxrwx 3 root wheel 3 Apr 26 04:35 ..

I am not sure how to fix it realy
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
that looks writable to me. strange owncloud is showing otherwise. I have never had an issue with that (and I have tested this guide a bunch).
Are you sure the dataset you are mounting in doesn't have windows ACLs enabled, and the mountpoint isn't read-only?

you could test a write
Code:
su -m www -c 'touch /mnt/files/test'
 

Elo

Contributor
Joined
Mar 11, 2012
Messages
122
Hi .. While waiting I did the nginx.conf again as I had emptied the file and put your code in it. Instead now I did a replace and changed the workprocesses number and let the rest remain (although only comments) . Then I restarted the entire FreeNAS machine and it started working. Thank you for your pacience :smile:

As you could see I have given all permission so I need to go through and reduce in order to maintain safety.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Hi .. While waiting I did the nginx.conf again as I had emptied the file and put your code in it. Instead now I did a replace and changed the workprocesses number and let the rest remain (although only comments) . Then I restarted the entire FreeNAS machine and it started working. Thank you for your pacience :)

As you could see I have given all permission so I need to go through and reduce in order to maintain safety.
sounds good.
yeah, 700 should be fine for the folder. and you could even remove execute privlidges for files, though I'm not sure how to do that off the top of my head without changing it for folders as well.
 

Elo

Contributor
Joined
Mar 11, 2012
Messages
122
I will figure that out. I have one more issue. I tried to do the very last comands in your guide :

I fixed this . The mnt directory needs to be www:www. I had changed it back to root:wheel !!!!

su -m www -c 'php /usr/local/www/owncloud/occ config:system:set memcache.local --value="\OC\Memcache\APCu"'

The process control (PCNTL) extensions are required in case you want to interrupt long running commands - see http://php.net/manual/en/book.pcntl.php
Data directory (/mnt/files/) is invalid
Please check that the data directory contains a file ".ocdata" in its root.

Cannot create "data" directory (/mnt/files/)
This can usually be fixed by <a href="https://doc.owncloud.org/server/9.1/go.php ?to=admin-dir_permissions" target="_blank" rel="noreferrer">giving the webserver write access to the root directory</a>.

An unhandled exception has been thrown:
Exception: Environment not properly prepared. in /usr/local/www/owncloud/lib/pri vate/Console/Application.php:120
Stack trace:
#0 /usr/local/www/owncloud/console.php(101): OC\Console\Application->loadCommand s(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Co nsole\Output\ConsoleOutput))
#1 /usr/local/www/owncloud/occ(11): require_once('/usr/local/www/...')
#2 {main}root@Owncloudjail:/ #

I do not understand the error messages as the directory exsists and it does contain the .ocdata file?=??

I have not tried the remaining three commands and I do not understand their purpose?
 
Last edited:

Elo

Contributor
Joined
Mar 11, 2012
Messages
122
Permissions and ownerships cleaned up and it seems to work fine. Again thank you for your kind help it has realy saved me a lot of time.

I have one last question for you. When using the instant upload of pictures from portable devices. Do you know if that is like a backup so tjhat the files can be removed from the mob device or is it like a synck function.

Thanks .../Ole
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Permissions and ownerships cleaned up and it seems to work fine. Again thank you for your kind help it has realy saved me a lot of time.

I have one last question for you. When using the instant upload of pictures from portable devices. Do you know if that is like a backup so tjhat the files can be removed from the mob device or is it like a synck function.

Thanks .../Ole
I only have experience with the android app. and have not used the owncloud app in a while, since I switched to nextcloud.

There it is a backup. after they have uploaded you can delete the folder in your gallary/camera app and they will still be in owncloud.
 
  • Like
Reactions: Elo

Elo

Contributor
Joined
Mar 11, 2012
Messages
122
I have read about the nextcloud release and the story behind it. I think I will try it out as I am at a point where I will set up everything new anyhow. Any good instalations guides?

Addition: Joshua. I instaled Nextcloud 11.0.3 according to your revised owncloud procedure and NextCloud is working fine ... Again Thx a lot
 
Last edited:

jag131990

Explorer
Joined
Dec 2, 2016
Messages
68
Thanks Josh. I was trying to login to smb shares with www so I didn't have to create a user in the group. All good.
 

kwessel

Dabbler
Joined
Mar 30, 2015
Messages
44
I used your tutorial to set up two boxes. Both were working great but I now have the following problem. With one of the boxes I can access OwnCloud with a browser but I am not able to sync with the OwnCloud desktop client. The client runs constantly with this message: "Checking for changes in" various directories. Any suggestions to get desktop client to sync again?
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
I used your tutorial to set up two boxes. Both were working great but I now have the following problem. With one of the boxes I can access OwnCloud with a browser but I am not able to sync with the OwnCloud desktop client. The client runs constantly with this message: "Checking for changes in" various directories. Any suggestions to get desktop client to sync again?
you have 2 different owncloud servers?

Have you verified a fresh install of the client does not work? Maybe try deleting the server connection from the client and setting it up again to a different folder just to test.
 

kwessel

Dabbler
Joined
Mar 30, 2015
Messages
44
Yes, I have 2 owncloud servers. They are not connected or related to each other in anyway.

I ran your test and was able to sync a different folder from the desktop.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Yes, I have 2 owncloud servers. They are not connected or related to each other in anyway.

I ran your test and was able to sync a different folder from the desktop.
im guessing theres something hung/stuck on your folder. i would just delete the folder and resync it fresh.
 

kwessel

Dabbler
Joined
Mar 30, 2015
Messages
44
Thansk Joshua. I reversed the process by deleting the test connection and starting over. That worked. Interestingly, I had uninstalled and done a fresh install of desktop client and that did not work. There are 4tb of photos in the folder and the sync is via 5mbs upload on the Internet, so thankfully it is running again.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Thansk Joshua. I reversed the process by deleting the test connection and starting over. That worked. Interestingly, I had uninstalled and done a fresh install of desktop client and that did not work. There are 4tb of photos in the folder and the sync is via 5mbs upload on the Internet, so thankfully it is running again.
Wow, that may take a while, lol. You might/may be able to move over the files that were there, but I'm not sure if it needs some metadata/hidden files to properly deal with the files.

I remember a few years ago (before the nextcloud split) i would always have issues with the client syncing on mine/family computers.
But syncing has become more and more reliable with the owncloud client, and i haven't really had issues like i used to with the nextcloud client either.
 
Last edited:
Top