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

mcolinp

Explorer
Joined
Jan 30, 2013
Messages
84
So now I seem to hit a wall when I try to "replace contents of: /usr/local/etc/nginx/nginx.conf"
I am using nano; and every time I Cut the contents of this file (starting after Worker Processes line . . .) and paste the code text form the forum; the shell crashes. ( I am using the web GUI shell for the Jail.)
I am sure I am going about this wrong; but not sure how. Is there a way to stop nginx while I make the changes to the config file? I would assume that is why it is crashing every time.

-EDIT- Anyone who has this problem; I figured out from a post elsewher that the web GUI shello copy/paste function; for some reason does not support this symbol: ~

So by carefully going and doing it line by line; and looking for the ~ symbol, (which you can put in manually with your keyboard), it works!
 
Last edited:

mcolinp

Explorer
Joined
Jan 30, 2013
Messages
84
So after some more efforts; I got past this step:

/var/db/mysql/my.cnf
Code (text):
  1. [server]
  2. socket = /tmp/mysql.sock
  3. skip-networking
  4. skip-name-resolve
  5. default-storage-engine = innodb
  6. innodb_flush_method = O_DIRECT
  7. skip-innodb_doublewrite
  8. innodb_flush_log_at_trx_commit = 2
  9. innodb_file_per_table
  10. expire_logs_days = 1
Which I took to mean creating a "my.cnf" file with lines 1-10 pasted into it . . .

When I go to the next step:

  1. service nginx start && service php-fpm start && service mysql-server start
  2. mysql_secure_installation
  3. mysql -u root -p
  4. CREATE DATABASE owncloud;
  5. GRANT ALL PRIVILEGES ON owncloud.* TO 'ocuser'@'localhost' IDENTIFIED BY 'ocpass';
  6. FLUSH PRIVILEGES;
  7. quit;
I enter Line 1 into the Jail shell; and it returns this message:

Performing sanity check on nginx configuration:
nginx: [emerg] location "\.php(?:$|/)" is outside location "^/owncloud" in /usr/
local/etc/nginx/nginx.conf:29
nginx: configuration file /usr/local/etc/nginx/nginx.conf test failed
Starting nginx.
nginx: [emerg] location "\.php(?:$|/)" is outside location "^/owncloud" in /usr/
local/etc/nginx/nginx.conf:29
/usr/local/etc/rc.d/nginx: WARNING: failed to start nginx
root@ownCLOUD:/ #

Not sure what to make of that . . .

-EDIT- Did I assume wrong that the step I last failed on goes into the Jail Shell? Does it instead go into the file I had previously created, called "my.cfg"?
 

mcolinp

Explorer
Joined
Jan 30, 2013
Messages
84
So I have succeeded in installing owncloud; and setting up a Admin User through the owncloud local WebGUI. I entered the specifics for Storage and Database; but when I go to the home directory (or any directory); the files I linked to in a separate ZFS data set are not present. I have been using owncloud as a PBI; and understand how to add storage correctly. And I have been careful to follow all the steps of the guide appropriately (more than once); yet still no external files from FreeNAS . . .

Any Ideas?
 

Rickle

Dabbler
Joined
Aug 14, 2013
Messages
38
Ive had a similar issue another jail. Deleting the jail storage entry and re-adding it fixed it for me.
 

mcolinp

Explorer
Joined
Jan 30, 2013
Messages
84
Oh, Thank You.

I already had thrown in the towel; deleted the jail, and was starting to re-create another: except changing the /mnt/files to /media.
Although I think I would rather do it like you said though, because it is daunting to try and change all references throughout the entire guide . . .

EDIT: If I can get this going with Cyberjock's SSL as well as your Fail2ban solution; I am contemplating doing a comprehensive guide that goes all the way through. (With very descriptive actions for moderate newbies; like myself.) As long as everyone is Ok with that . . . .
 

mcolinp

Explorer
Joined
Jan 30, 2013
Messages
84
I am not sure what is going on; I tried deleting the Storage Entry(ies) and re-adding them. Nothing. I tried using the /media folder like I was doing with my PBI version of owncloud. Nothing . . .

Hmmpph://
 

mcolinp

Explorer
Joined
Jan 30, 2013
Messages
84
When I previously used the pbi version of owncloud, the linked storage (FreeNAS dataset) had www user and group permissions in order to work with the owncloud plugin. Did I make a wrong assumption that manually installing owncloud on a portjail; would also use www as the user and group? I thought the guide indicated that www was the user; but I cannot for the life of me figure out why owncloud does not have access to my FreeNAS data.
 

mcolinp

Explorer
Joined
Jan 30, 2013
Messages
84
Ok; So after looking at the guide again; trying to see where I may have gotten off track: I think it may be the step right near the end . . .

Where it has this in a code box:

  1. crontab -u www -e

    Then it says:

    "Append"
    1. */15 * * * * /usr/local/bin/php -f /usr/local/www/owncloud/cron.php

      I was confused as to what exactly I was being asked to do. Since it said append; I thought that it was expecting me to type: nano crontab -u www -e
      Then; Append "*/15 * * * * /usr/local/bin/php -f /usr/local/www/owncloud/cron.php" to each page of the document created.

      I am pretty sure this is likely wrong; and any help would be greatly appreciated.


      -EDIT- I have played with those two commands again, and if I simply paste the contab -u www -e into the jail shell; it returns a bunch of lines that look like this:
      ~
      ~
      ~
      ~
      ~
      ~
      ~
      ~
      ~

      I then tried to simply paste the following:

      */15 * * * * /usr/local/bin/php -f /usr/local/www/owncloud/cron.php

      Which returns this message:

      "File empty; nothing to search"
  2. -EDIT- I did end up figuring out the correct way to edit crontab, as discussed elsewhere in this thread.
 
Last edited:

mcolinp

Explorer
Joined
Jan 30, 2013
Messages
84
So there seems to be A LOT of people having issues with linked datasets not passing through to Jails. (I mean at this release; not just in general history . . . ) Seems there are problems with the "Add Storage" function; namely the "Create Directory" option is not functioning correctly. As a workaround I was trying to use mkdir to create the folder in the jail to mnt the outside data; which also seems to be plagued with problems currently. I tried installing a plugin PBI version of own cloud like I had been using; same. No files are available from outside the jail; and it was working for me before using the same permissions: "www".

Has anyone else tried to do a fresh build using this guide with the current releases: Freenas - 9.2.1.7 & owncloud 7.0.1? Just curious; since I have tried without success likely over 20 times. I have succeeded in getting own cloud working; just not with the files I need it to work with from Freenas.
 

norskman

Contributor
Joined
Sep 28, 2012
Messages
149
while back, i asked for a sticky, where the instructions could be posted - without having comments in between.
I had to create my own document entered as I went to make it work. It does work, I am not an expert by a long shot. ( see my posts....) . I found that this route is good - it uses MYSQL and is generally faster. However, it takes a lot longer to install than clicking on a plugin.

Right now the plugin is on V6.03 - which means upgrading it to V7.01 thereafter. If you are not too confident about editing files and debugging do not install a non-plugin version. Otherwise the instructions are correct if not dis-jointed like this one
 

mcolinp

Explorer
Joined
Jan 30, 2013
Messages
84
Yeah; I have gotten owncloud to install using the method from this guide. But as I said there seems to be a problem with linking the data from a FreeNAS dataset. I had a plugin version of owncloud working that way up till I started trying to mess with this guide after the 9.2.1.7 upgrade. It was working fine; and now I can't even get the PBI version to link to my dataset. Something is definitely wrong.

(Not necessarily with the guide; but rather a bug related to adding storage.)
 

mcolinp

Explorer
Joined
Jan 30, 2013
Messages
84
The funny thing about all this; is that when I go to the folder where the outside data is supposed to be linked in the owncloud jail; such as "/mnt/files" if you followed this guide exactly. I can cd to that directory; "cd /mnt/files" then list; "ls", which returns all the files I expect to be there from the FreeNAS dataset. Yet they never show up in the owncloud webui.
 

neto_hugo

Explorer
Joined
Mar 6, 2012
Messages
87
Guys, a very silly question ...

I believe I could get SSL works on my OC. In Google Chrome the symbol 'https:' is red with a cross (as you can see in the picture below) ...

SSL owncloud.jpg


Should not be green? Or is it anyway?

SSL owncloud 2.jpg


Thank you all
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
It should be whatever it is for conditions.. Look at the cert info and you will probably find it is self-signed. That's immediately an "untrusted" cert.
 

Wade

Contributor
Joined
Feb 16, 2014
Messages
110
Hello all,

I'm almost finished with the http portion of the install. My question is how do I solve this error?

ERROR 1006 (HY000): Can't create database 'owncloud' (errno: 13)

I realize it's a permissions problem (permissions my worst enemy) but I cant resolve it. Any help is appreciated, thanks!

also: when I "SHOW DATABASES;" nothing is there, not even the test database
 

Wade

Contributor
Joined
Feb 16, 2014
Messages
110
For any other noobs stuck on this,

chown -R mysql:mysql /var/db/mysql

now I can list and create databases
 

Wade

Contributor
Joined
Feb 16, 2014
Messages
110
A very big thanks to Josh for an excellent guide. It took me two trys but now owncloud 7 is running with no errors! And pretty durn snappy if I may add, I mean lightening fast! Thanks to all who contributed to this thread.

A humble suggestion for Josh, a revision date for each time the instructions are updated would be very helpful. I almost passed this wonderful guide up because it was dated January and there was other newer guides on the forum. It wasnt till after reading through most of the thread that I realized you had been tweaking and making incremental updates as things changed. Thank you!

Im a noob, so I'd like to point out a few snags in the guide that my brother noobs may not catch initally.

1. When installing mysql, mariadb etc; you will come to a point where it asks you to patch a file, I hit ok, even though I didn't know where the file to be patched was, though I suppose you could just hit cancel instead of ok. Either way, when you get back to the prompt put "pkg install m4" then "make clean -C /usr/ports/devel/pecl-APCu" this will allow you to continue the guide.

2. Towrads the beggining of the guide you will be asked to create a jail and storage. You will get errors cuz you cant mount storage folders that don't exist. Its ok, these folders will be created later in the guide. The only folder that you "will" have to mannually create is "/mnt/files"

3. If you run into a problem where you cant write databases, at the prompt run "chown -R mysql:mysql /var/db/mysql" there is also useful info about databases @ https://www.digitalocean.com/commun...abases-in-mysql-and-mariadb-on-a-cloud-server

4. Initially my.cnf does not exist, you have to manually create it and add the info from the guide.

So, here I am with a kick but owncloud, but im confined to my lan =( Im going to take a few snap shots and attempt to get SSL working. Let the convolution begin!! LOL I was under the impression that all you had to do was port forward your ownloud LAN to WAN so it can be seen on the interent, then have owncloud server (nginx) point to your ssl certs.

Should I follow cybers guide? Is everyone re-installing nginx to get ssl rolling?

Thank you
 

Wade

Contributor
Joined
Feb 16, 2014
Messages
110
Hey all, I had to reboot my freenas box, now when I log into OC instead of the login screen I get this:

[1045] SQLSTATE[HY000] [1045] Access denied for user 'ocuser'@'localhost' (using password: YES)

I've googled the error but cant figure it out. I'm stuck, any help is appreciated.

Thank you
 
Top