Register for the iXsystems Community to get an ad-free experience and exclusive discounts in our eBay Store.

Pydio using NGINX, PHP-FPM, and MySQL

Status
Not open for further replies.

Joshua Parker Ruehlig

Wizened Sage
Joined
Dec 5, 2011
Messages
5,949
INTRODUCTION
This guide's purpose is to show my recommended method to install Pydio in a jail on FreeNAS. This method does not use the FreeBSD port www/pydio and instead runs the Pydio source on NGINX, PHP-FPM, and MySQL.

INSTALLATION

NOTES
  • I use a subdirectory '/pydio' for my Pydio instance; this is because I have other applications running in other sub-directories. I don't use sub-domains because I want everything on a single domain. I pay for a domain name and get a free SSL Certificate from StartSSL. The free SSL Certificate only works for the domain and a single sub-domain (usually www). You can alternatively choose to host Pydio at the '/' of your server.
  • I have my SSL terminated by HAProxy running on my pfSense router. If you don't have this option, I recommend setting up SSL in NGINX.
 
Last edited:

Joshua Parker Ruehlig

Wizened Sage
Joined
Dec 5, 2011
Messages
5,949
INSTALLATION

FreeNAS WebUI
Jails > Add Jails

Console in jail's userland
Code:
pkg upgrade && pkg install nginx mariadb101-server php70-extensions php70-exif php70-gd php70-mcrypt php70-mysqli php70-openssl php70-zlib php70-APCu
sysrc nginx_enable="YES" php_fpm_enable="YES" mysql_enable="YES"
cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini
ln -s /usr/local/share/certs/ca-root-nss.crt /etc/ssl/cert.pem


  • Set 'worker_processes' to your FreeNAS server's number of threads
  • Set 'client_max_body_size' to your desired maximum upload filesize
Code:
worker_processes 2;

events {
  worker_connections  1024;
}

http {
	include  mime.types;
	default_type  application/octet-stream;
	sendfile  off;
	keepalive_timeout  65;
	gzip off;

	server {
		root /usr/local/www;
		location ^~ /pydio {
			index index.php;
			try_files $uri $uri/ /pydio/index.php$is_args$args;
			client_max_body_size 512M;
			location ~ ^/pydio/(?:\.|conf|data/(?:cache|files|logs|personal|plugins|tmp)|plugins/editor.zoho/agent/files) {
				deny all;
			}
			location ~ \.php$ {
				try_files $uri =404;
				fastcgi_pass unix:/var/run/php-fpm.sock;
				fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
				include fastcgi_params;
			}
			location ~* \.(?:jpg|jpeg|png|gif|ico|css|js)$ {
				expires 30d; add_header Cache-Control public;
			}
		}
	}
}

Code:
date.timezone = America/Los_Angeles
cgi.fix_pathinfo=0
output_buffering = Off
upload_max_filesize = 512M
post_max_size = 512M

Code:
listen = /var/run/php-fpm.sock
listen.owner = www
listen.group = www
env[PATH] = /usr/local/bin:/usr/bin:/bin

Code:
[server]
skip-networking
skip-name-resolve
expire_logs_days = 1
innodb_flush_method = O_DIRECT
skip-innodb_doublewrite
innodb_flush_log_at_trx_commit = 2
innodb_file_per_table

Code:
service nginx start && service php-fpm start && service mysql-server start
mysql -e "CREATE DATABASE pydio;"
mysql -e "GRANT ALL PRIVILEGES ON pydio.* TO 'pydiouser'@'localhost' IDENTIFIED BY 'pydiopass';"
mysql -e "FLUSH PRIVILEGES;"
mysql_secure_installation


Code:
fetch "https://download.pydio.com/pub/core/archives/pydio-core-7.0.1.tar.gz"
tar zxf pydio-core-*.tar.gz
rm -r pydio-core-*.tar.gz
mv pydio-core-* /usr/local/www/pydio
chown -R www:www /usr/local/www/pydio


Pydio WebUI
(http://Jail_IP/pydio/?ignore_tests=true)

Database Connexion
  • Host = localhost:/tmp/mysql.sock
  • User = pydiouser
  • Password = pydiopass
Advanced Options
Settings > Application Core > Pydio Main Options
  • Command-Line Active = Yes
Console in jail's userland
Code:
crontab -u www -e

  • Replace ADMIN_LOGIN and ADMIN_PASSWORD with your Pydio username and password
Code:
*/5 * * * * /usr/local/bin/php /usr/local/www/pydio/cmd.php -r=ajxp_conf -u=ADMIN_LOGIN -p=ADMIN_PASSWORD -a=scheduler_runAll >> /usr/local/www/pydio/data/cache/cmd_outputs/cron_commands.log
 
Last edited:

Joshua Parker Ruehlig

Wizened Sage
Joined
Dec 5, 2011
Messages
5,949
reserved
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,598
Any idea on how to get this to use a mounted dataset as the storage for synced files?
 

Joshua Parker Ruehlig

Wizened Sage
Joined
Dec 5, 2011
Messages
5,949
When I was browsing settings I saw something about setting this location. I'd mount a dataset to /mnt/data and change the setting to that location.
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,598
Are you talking about the settings in the web UI? I can't seem to find it.
 

Joshua Parker Ruehlig

Wizened Sage
Joined
Dec 5, 2011
Messages
5,949
maybe you need to do it before installing =[
https://pyd.io/f/topic/assigning-ajxp_data_path/

I would set that path from the link.
delete /usr/local/www/pydio and the pydio database you created.
then redo the steps from the 'mysql -u root -p' command
then St
 

marian78

Member
Joined
Jun 30, 2011
Messages
207
Last edited:

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,598
No you're not doing anything wrong. The version 6 sync client is still in beta and still has some very serious bugs. I used the old Java version and it works fine.
 

marian78

Member
Joined
Jun 30, 2011
Messages
207
thx, i try.
 

Joshua Parker Ruehlig

Wizened Sage
Joined
Dec 5, 2011
Messages
5,949
and you only need the ignore_tests header when your setting it up. I'd personally set it up in a browser, then setup your clients
 

WhiteEagle112

Neophyte
Joined
Dec 24, 2014
Messages
8
hello

@Joshua Parker Ruehlig

i have a problem XD

ehmm.. i did a new jail, named PYDIO

i opened the therminal from the jail and write those:

  • pkg upgrade && pkg install nginx mariadb100-server mariadb100-client php56-extensions php56-exif php56-gd php56-mcrypt php56-openssl php56-pdo_mysql php56-zlib
  • sysrc nginx_enable="YES" php_fpm_enable="YES" mysql_enable="YES"
  • cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini
  • ln -s /usr/local/share/certs/ca-root-nss.crt /etc/ssl/cert.pem
seperatly in and enter after the first line there are coming some install i need to aceppt (with that "y")
after second there are coming some yes :smile:
the last 2 did nothing i can see.

so then i dont know, do i need to past taht inside
Show /usr/local/etc/nginx/nginx.conf
? becouse i becoming error command not found.

you can see it there : http://pastebin.com/ej1RK8ae

thx for help, maybe i am doing somthing nooby **** :-D sorry for that ;-)

and thank you for your guide!! =)
 

Joshua Parker Ruehlig

Wizened Sage
Joined
Dec 5, 2011
Messages
5,949
hello

@Joshua Parker Ruehlig

i have a problem XD

ehmm.. i did a new jail, named PYDIO

i opened the therminal from the jail and write those:



seperatly in and enter after the first line there are coming some install i need to aceppt (with that "y")
after second there are coming some yes :smile:
the last 2 did nothing i can see.

so then i dont know, do i need to past taht inside ? becouse i becoming error command not found.

you can see it there : http://pastebin.com/ej1RK8ae

thx for help, maybe i am doing somthing nooby **** :-D sorry for that ;-)

and thank you for your guide!! =)
yeah, anything hidden by Show button should be pasted into the referenced file. as make sure I don't just say replace relevant lines, which means don't overwrite the whole file.
 

WhiteEagle112

Neophyte
Joined
Dec 24, 2014
Messages
8
yeah, anything hidden by Show button should be pasted into the referenced file. as make sure I don't just say replace relevant lines, which means don't overwrite the whole file.

thx for that fast replay! :smile: but like you see in the pastebin, there is no reference file coming up.

you see what i did. insert "Show /usr/local/etc/nginx/nginx.conf" so i can edit it, right? or shouldn't i write that in the terminal?

that in the postebin is a copie from the last lines of terminal
 

Joshua Parker Ruehlig

Wizened Sage
Joined
Dec 5, 2011
Messages
5,949
thx for that fast replay! :smile: but like you see in the pastebin, there is no reference file coming up.

you see what i did. insert "Show /usr/local/etc/nginx/nginx.conf" so i can edit it, right? or shouldn't i write that in the terminal?

that in the postebin is a copie from the last lines of terminal
"Show" isn't a command. that's just what this forum has when I hid some instructions. you need to use an editor to paste the stuff into a file. 'ee' is an easy one to use.
ee /usr/local/etc/nginx/nginx.conf
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,598
maybe you need to do it before installing =[
https://pyd.io/f/topic/assigning-ajxp_data_path/

I would set that path from the link.
delete /usr/local/www/pydio and the pydio database you created.
then redo the steps from the 'mysql -u root -p' command
then St
Well I figured out how to add the mounted storage but I can't seem get permissions right on the dataset so pydio can write to it.

I'll play with this a little more in the morning, it's getting late for us old folks.
 

Joshua Parker Ruehlig

Wizened Sage
Joined
Dec 5, 2011
Messages
5,949
Well I figured out how to add the mounted storage but I can't seem get permissions right on the dataset so pydio can write to it.

I'll play with this a little more in the morning, it's getting late for us old folks.
assumming it's mounted at /mnt/files you can run
Code:
chown -R www:www /mnt/files
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,598
It's working now. It helps if you check the box to actually mount the storage location...... :oops:
 

Joshua Parker Ruehlig

Wizened Sage
Joined
Dec 5, 2011
Messages
5,949
It's working now. It helps if you check the box to actually mount the storage location...... :oops:
I think it should be on by default but stuff happens
 

WhiteEagle112

Neophyte
Joined
Dec 24, 2014
Messages
8
"Show" isn't a command. that's just what this forum has when I hid some instructions. you need to use an editor to paste the stuff into a file. 'ee' is an easy one to use.
ee /usr/local/etc/nginx/nginx.conf

ohh haha i thougt i nbeed to open it. but i didnt know not with show haha

so no i have opened like you said and ehmm.. check that out XD : http://pastebin.com/k0vnP7qi

seems i am doing somthing wrong. have some errors

so maybe i do a full fresh install of the freenas on my virtualbox so i can do it from begining new?
 
Status
Not open for further replies.
Top