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

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
Joshua:

I see at the top that you said this will be much faster than the PBI version. Can you elaborate? I've noticed that if I have ten 1KB files it takes like 10 seconds. It seems to upload a file, then waits a second or two, then does the next file. Is that problem non-existent with your setup?
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Joshua:

I see at the top that you said this will be much faster than the PBI version. Can you elaborate? I've noticed that if I have ten 1KB files it takes like 10 seconds. It seems to upload a file, then waits a second or two, then does the next file. Is that problem non-existent with your setup?

I don't know if it would be much faster in all aspects (it wouldn't help much with large file transfers) but it will definitely do some operations faster.
  • Using a database running as a daemon will do database intensive tasks faster , I would assume there are some database writes slowing your 10*1KB transfer.
  • Also, my setup includes installing opcache for PHP55 which can greatly speedup PHP execution.
  • Finally, by using PHP-FPM, Apache doesn't need to spawn a php process everytime code needs to be run, the workers are always sitting there, taking a bit of memory, but ready to work
If you're interested I suggest you just make a jail to test it in.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
Ok, so I'm trying to install owncloud per the guide, and I see no step to actually install mysql... is that oversight?

Code:
root@Owncloud6:/usr/ports # service mysql start
mysql does not exist in /etc/rc.d or the local startup
directories (/usr/local/etc/rc.d)
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Ok, so I'm trying to install owncloud per the guide, and I see no step to actually install mysql... is that oversight?

Code:
root@Owncloud6:/usr/ports # service mysql start
mysql does not exist in /etc/rc.d or the local startup
directories (/usr/local/etc/rc.d)

mariadb55-server is installed. And it's..
Code:
service mysql-server start/stop/status
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
Ah.. I see the problem.

Code:
oot@Owncloud6:/ # pkg install mariadb55-server
Updating repository catalogue
pkg: No packages matching 'mariadb55-server' has been found in the repositories


Its apparently gone...
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Ah.. I see the problem.

Code:
oot@Owncloud6:/ # pkg install mariadb55-server
Updating repository catalogue
pkg: No packages matching 'mariadb55-server' has been found in the repositories


Its apparently gone...

Just tried it and it worked for me? You're on FreeNAS 9.2 with a jail created since installing 9.2? Can you install other packages? Also, it's possible the mirror you're connecting to is missing the package for some reason.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
Yeah, I installed all the other packages without a problem. nginx and php-fpm started without a hitch.

I knew something was up when I went to/var/db/mysql/my.cnf and the mysql folder didn't exist. Now I see there's something more insidious. I think I'll just compile from ports.

This whole thing is weird, this is a brand new jail I just created an hour ago. Been flawless except for this mariadb thing. Eh, whatever. It's compiling...
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
And it won't compile either.

pkg-static: fstat() failed for(/usr/local/bin/msql2mysql): No such file or directory
pkg-static: fstat() failed for(/usr/local/bin/mysql): No such file or directory
pkg-static: fstat() failed for(/usr/local/bin/mysql_config): No such file or directory
pkg-static: fstat() failed for(/usr/local/bin/mysql_find_rows): No such file or directory
pkg-static: fstat() failed for(/usr/local/bin/mysql_waitpid): No such file or directory
pkg-static: fstat() failed for(/usr/local/bin/mysqlaccess): No such file or directory
pkg-static: fstat() failed for(/usr/local/bin/mysqladmin): No such file or directory
pkg-static: fstat() failed for(/usr/local/bin/mysqlbinlog): No such file or directory
pkg-static: fstat() failed for(/usr/local/bin/mysqlcheck): No such file or directory
pkg-static: fstat() failed for(/usr/local/bin/mysqldump): No such file or directory
pkg-static: fstat() failed for(/usr/local/bin/mysqlimport): No such file or directory
pkg-static: fstat() failed for(/usr/local/bin/mysqlshow): No such file or directory
pkg-static: fstat() failed for(/usr/local/bin/mysqlslap): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/auth_dialog_client.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/client_plugin.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/decimal.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/errmsg.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/handler_state.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/keycache.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/m_ctype.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/m_string.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/ma_dyncol.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/my_alloc.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/my_attribute.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/my_compiler.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/my_config.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/my_dbug.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/my_decimal_limits.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/my_dir.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/my_getopt.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/my_global.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/my_list.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/my_net.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/my_pthread.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/my_sys.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/my_valgrind.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/my_xml.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/mysql.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/mysql_com.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/mysql_embed.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/mysql_time.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/mysql_version.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/mysqld_ername.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/mysqld_error.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/plugin.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/plugin_audit.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/plugin_auth.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/plugin_auth_common.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/plugin_ftparser.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/psi/mysql_file.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/psi/mysql_thread.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/psi/psi.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/service_debug_sync.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/service_kill_statement.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/service_logger.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/service_my_snprintf.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/service_progress_report.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/service_thd_alloc.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/service_thd_wait.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/service_thread_scheduler.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/services.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/sql_common.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/sql_state.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/sslopt-case.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/sslopt-longopts.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/sslopt-vars.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/include/mysql/typelib.h): No such file or directory
pkg-static: fstat() failed for(/usr/local/lib/mysql/libmysqlclient.a): No such file or directory
pkg-static: fstat() failed for(/usr/local/lib/mysql/libmysqlclient.so): No such file or directory
pkg-static: fstat() failed for(/usr/local/lib/mysql/libmysqlclient.so.18): No such file or directory
pkg-static: fstat() failed for(/usr/local/lib/mysql/libmysqlclient_r.a): No such file or directory
pkg-static: fstat() failed for(/usr/local/lib/mysql/libmysqlclient_r.so): No such file or directory
pkg-static: fstat() failed for(/usr/local/lib/mysql/libmysqlclient_r.so.18): No such file or directory
pkg-static: fstat() failed for(/usr/local/man/man1/msql2mysql.1.gz): No such file or directory
pkg-static: fstat() failed for(/usr/local/man/man1/mysql.1.gz): No such file or directory
pkg-static: fstat() failed for(/usr/local/man/man1/mysql_config.1.gz): No such file or directory
pkg-static: fstat() failed for(/usr/local/man/man1/mysql_find_rows.1.gz): No such file or directory
pkg-static: fstat() failed for(/usr/local/man/man1/mysql_plugin.1.gz): No such file or directory
pkg-static: fstat() failed for(/usr/local/man/man1/mysql_waitpid.1.gz): No such file or directory
pkg-static: fstat() failed for(/usr/local/man/man1/mysqlaccess.1.gz): No such file or directory
pkg-static: fstat() failed for(/usr/local/man/man1/mysqladmin.1.gz): No such file or directory
pkg-static: fstat() failed for(/usr/local/man/man1/mysqlbinlog.1.gz): No such file or directory
pkg-static: fstat() failed for(/usr/local/man/man1/mysqlcheck.1.gz): No such file or directory
pkg-static: fstat() failed for(/usr/local/man/man1/mysqldump.1.gz): No such file or directory
pkg-static: fstat() failed for(/usr/local/man/man1/mysqlimport.1.gz): No such file or directory
pkg-static: fstat() failed for(/usr/local/man/man1/mysqlshow.1.gz): No such file or directory
pkg-static: fstat() failed for(/usr/local/man/man1/mysqlslap.1.gz): No such file or directory
pkg-static: fstat() failed for(/usr/local/share/aclocal/mysql.m4): No such file or directory
pkg-static: fstat() failed for(/usr/local/libdata/ldconfig/mariadb): No such file or directory
Installing mariadb55-client-5.5.33a_1... done
===> Returning to build of mariadb55-server-5.5.33a_1
Error: shared library "mysqlclient.18" does not exist
*** [lib-depends] Error code 1

Stop in /usr/ports/databases/mariadb55-server.
*** [install] Error code 1

Stop in /usr/ports/databases/mariadb55-server.

Something weird is going on...
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
Something is very wrong... I used my other jail from a week ago. I can't install mariadb55-server from that either.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
Code:
root@Owncloud6:/usr/ports/databases/mariadb55-server # pkg search maria
mariadb-client-5.3.12
mariadb-client-5.5.31
mariadb-scripts-5.3.12
mariadb-server-5.3.12
mariadb-server-5.5.31


So I did pkg install mariadb-server-5.5.31. /shrug

Everything seems to be continuing just fine now. Owncloud .bz2 is downloading, at 80k/sec... /sigh
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Code:
root@Owncloud6:/usr/ports/databases/mariadb55-server # pkg search maria
mariadb-client-5.3.12
mariadb-client-5.5.31
mariadb-scripts-5.3.12
mariadb-server-5.3.12
mariadb-server-5.5.31


So I did pkg install mariadb-server-5.5.31. /shrug

Everything seems to be continuing just fine now. Owncloud .bz2 is downloading, at 80k/sec... /sigh

Glad you got it working, not sure what's wrong with your setup / repo. And yeah, owncloud's servers are unbearably slow =[
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
Actually, I'm having other problems.. when I go to the web address I get an ssl error.. SSL received a record that exceeded the maximum permissible length.

Gonna try wiping it clean and going again. I did notice that the nginx.conf stuff in the thread doesn't have a listen value. apparently the default doesn't go well with FreeNAS since going to https://jail.ip/owncloud redirects to the freenas webgui. ;)
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Actually, I'm having other problems.. when I go to the web address I get an ssl error.. SSL received a record that exceeded the maximum permissible length.

Gonna try wiping it clean and going again. I did notice that the nginx.conf stuff in the thread doesn't have a listen value. apparently the default doesn't go well with FreeNAS since going to https://jail.ip/owncloud redirects to the freenas webgui. ;)

Did you modify the nginx config to enable SSL with nginx? Your connecting to FreeNAS's webUI because the host system will usually bind on all available IPs (including alias IPs assigned to jails), unless the jail asks to use that IP, in which case the jail takes priority. So, to me it sounds like you didn't setup SSL?
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
Not sure. I'm thinking no since none of your settings changes appear to enable SSL. I know about nothing on setting up nginx, php, and mysql aside from what this thread does. I've never touched any of them before. So this is a fast and dirty learning experience for me. ;)

And wow.. gotta create a cert and stuff. May choose to be lazy and not do SSL.. LOL. Still is interesting that https is what it used right off the bat. I didn't know I had defaulted to https.(yes, I'm that out of my element with this).
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Not sure. I'm thinking no since none of your settings changes appear to enabled SSL. I know about nothing on setting up nginx, php, and mysql aside from what this thread does. I've never touched any of them before. So this is a fast and dirty learning experience for me. ;)

Well that explains it. You don't have SSL setup because I didn't instruct how to do it with NGINX. =P
There is no reason to start from scratch(unless things are truely borked), you can choose to enable SSL on you own, or live without SSL.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
I want SSL, I've got lots of Googling to do to figure it out though. ;) Good learning experience. I'll post back with what I learn for others to mimic if they desire.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
I want SSL, I've got lots of Googling to do to figure it out though. ;) Good learning experience. I'll post back with what I learn for others to mimic if they desire.

I proxy my SSL using HAProxy, but doing it with NGINX only takes a few lines I believe (though I've never actually done it).

Just keep in mind you'll get SSL errors when connecting unless you either..
  • add your certificate to your client
  • purchase an SSL cert
  • purchase a domain and use StartSSL's free SSL cert (how I do it).
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
Yeah, I'm way out of my league on this SSL thing. I'll have to play another day when I can find someone's example to steal and understand. I can't even figure out how to make my own signed cert.

I don't really care about the SSL error as I only get the error when the owncloud client connects to the server for the first time, and if I do an upgrade(which I did to the PBI version of owncloud earlier). If I'm not mistaken I'm not protected from potential man-in-the-middle attacks. But I wanted to see if the changes you've prescribed here make owncloud perform better. I just added 7800 files to my 5.0.12 machine(4.6GB total), and despite the server and desktop being idle(and both are horribly overpowered for this small task) it's been running for over 4 hours and it's almost to 1/2 way. Throughput on large files is 50MB/sec+, but small 1-3k files take about 4 seconds.

Edit: my owncloud PBI from 5.0.12 has been syncing for 16 hour straight and still not done. Performance is clearly crap. Which is why I want my own Joshua-approved jail. ;)
 

jonnn

Explorer
Joined
Oct 25, 2013
Messages
68
Does this guide enable me to access owncloud remotely from the internet? securely? I am slightly baffled.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Does this guide enable me to access owncloud remotely from the internet? securely? I am slightly baffled.
no, this guide only show the specific application setup. for external access just perform the standard steps you need for any application. you'd also need to add steps for SSL to make it secure.

I wrote a little information about doing this in the link below. I'll write a complete guide on how to do this eventually.
http://forums.freenas.org/threads/f...-htpc-mylar-ll-gamez.16200/page-12#post-96176
 
Top