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

Chakalov

Explorer
Joined
Feb 9, 2015
Messages
53
OC8 from the very beginning, haven't upgraded from 7
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
OC8 from the very beginning, haven't upgraded from 7
I mentioned a few posts back that they changed the way X-Accel works. I suggest you disable it for now by removing the line "fastcgi_param MOD_X_ACCEL_REDIRECT_ENABLED on;" then reloading nginx.
"service nginx reload"
 

Chakalov

Explorer
Joined
Feb 9, 2015
Messages
53
Phew... Thank you Josh!!!

Sorry for the trouble making!
 

ZDrt

Cadet
Joined
Jan 19, 2015
Messages
9
Hi anybody, Im trying make a new instalation of OC8 and I probably set something wrong about php. When I access jailip/owncloud I receive just a blank page. Source code of the page is totaly empty. I also try to put index.html to the usr/local/www directory and it works fine, I can see the page on jailip addess. If I try to access jailip/nonexistdirectory I receive a "correct" 404 error...

Can anybody help me what to check? Thx in advance
 

ZDrt

Cadet
Joined
Jan 19, 2015
Messages
9
Hi again, the solution is to reinstall all packages with "Joshua's command" from the guide
(pkg upgrade && pkg install nginx mariadb100-server php56-extensions php56-bz2 php56-curl .....)

Now I can see the webpages. But another problem is that I receive a message that mnt/files is readable for other users and it is necessary to change permisions to 0770.

Im in jail console as root and Im not able to chmod mnt/files.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Hi again, the solution is to reinstall all packages with "Joshua's command" from the guide
(pkg upgrade && pkg install nginx mariadb100-server php56-extensions php56-bz2 php56-curl .....)

Now I can see the webpages. But another problem is that I receive a message that mnt/files is readable for other users and it is necessary to change permisions to 0770.

Im in jail console as root and Im not able to chmod mnt/files.
Does the below command fix it?
Code:
chmod -R 770 /mnt/files
 

ZDrt

Cadet
Joined
Jan 19, 2015
Messages
9
No, it says:

root@owncloudjail:/ # chmod -R 770 /mnt/files
chmod: /mnt/files/owncloud.log: Operation not permitted
chmod: /mnt/files/.ocdata: Operation not permitted
chmod: /mnt/files/owncloudadmin/cache: Operation not permitted
chmod: /mnt/files/owncloudadmin/files/Documents/Example.odt: Operation not permitted
chmod: /mnt/files/owncloudadmin/files/Documents: Operation not permitted
chmod: /mnt/files/owncloudadmin/files/Photos/Paris.jpg: Operation not permitted
chmod: /mnt/files/owncloudadmin/files/Photos/Squirrel.jpg: Operation not permitted
chmod: /mnt/files/owncloudadmin/files/Photos/San Francisco.jpg: Operation not permitted
chmod: /mnt/files/owncloudadmin/files/Photos: Operation not permitted
chmod: /mnt/files/owncloudadmin/files/ownCloudUserManual.pdf: Operation not permitted
chmod: /mnt/files/owncloudadmin/files: Operation not permitted
chmod: /mnt/files/owncloudadmin: Operation not permitted
chmod: /mnt/files: Operation not permitted

I have no idea if it is important but all files and folders are owned by www user. Is there any www users password?
 
Last edited:

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
No, it says:

root@owncloudjail:/ # chmod -R 770 /mnt/files
chmod: /mnt/files/owncloud.log: Operation not permitted
chmod: /mnt/files/.ocdata: Operation not permitted
chmod: /mnt/files/owncloudadmin/cache: Operation not permitted
chmod: /mnt/files/owncloudadmin/files/Documents/Example.odt: Operation not permitted
chmod: /mnt/files/owncloudadmin/files/Documents: Operation not permitted
chmod: /mnt/files/owncloudadmin/files/Photos/Paris.jpg: Operation not permitted
chmod: /mnt/files/owncloudadmin/files/Photos/Squirrel.jpg: Operation not permitted
chmod: /mnt/files/owncloudadmin/files/Photos/San Francisco.jpg: Operation not permitted
chmod: /mnt/files/owncloudadmin/files/Photos: Operation not permitted
chmod: /mnt/files/owncloudadmin/files/ownCloudUserManual.pdf: Operation not permitted
chmod: /mnt/files/owncloudadmin/files: Operation not permitted
chmod: /mnt/files/owncloudadmin: Operation not permitted
chmod: /mnt/files: Operation not permitted

I have no idea if it is important but all files and folders are owned by www user. Is there any www users password?
Very strange, I wonder why you can't change permssions of those files.
Can you show the output from these two commands?
Code:
touch /mnt/files/test.txt
ls -l /mnt/files


They are supposed to be owned by the 'www' user, which owncloud runs as.
 

ZDrt

Cadet
Joined
Jan 19, 2015
Messages
9
Except the test.txt (created by root) they are...

root@owncloudjail:/ # touch /mnt/files/test.txt
root@owncloudjail:/ # ls -l /mnt/files
total 14
-rwxrwxr-x+ 1 www www 0 Feb 17 23:26 .ocdata
drwxrwxr-x+ 4 www www 4 Feb 17 23:26 user2
drwxrwxr-x+ 4 www www 4 Feb 12 22:35 owncloudadmin
-rwxrwxr-x+ 1 www www 29870 Feb 17 23:43 owncloud.log
-rwxrwxr-x+ 1 root www 0 Feb 17 23:46 test.txt
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Except the test.txt (created by root) they are...

root@owncloudjail:/ # touch /mnt/files/test.txt
root@owncloudjail:/ # ls -l /mnt/files
total 14
-rwxrwxr-x+ 1 www www 0 Feb 17 23:26 .ocdata
drwxrwxr-x+ 4 www www 4 Feb 17 23:26 user2
drwxrwxr-x+ 4 www www 4 Feb 12 22:35 owncloudadmin
-rwxrwxr-x+ 1 www www 29870 Feb 17 23:43 owncloud.log
-rwxrwxr-x+ 1 root www 0 Feb 17 23:46 test.txt
I googled you issue and stumbled upon this..
https://forums.freenas.org/index.php?threads/cant-chmod-files-operation-not-permitted.22229/

Did you happen to set windows permissions on the files dataset? If so, please don't do that. These files should only be accessed by the owncloud program directly.
 

ZDrt

Cadet
Joined
Jan 19, 2015
Messages
9
Yes I did...I have another plans with it :)
So, tomorrow I will be rebuilding the files dataset (create new one, destroy old one) as described...
Can you add this info (UNIX share) to your guide? Maybe it can stop somebody to do it..

Thanks for your help...
(I also found this topic but I was making couple of test using different commands like setacl and pw...wrong way :smile: )
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Yes I did...I have another plans with it :)
So, tomorrow I will be rebuilding the files dataset (create new one, destroy old one) as described...
Can you add this info (UNIX share) to your guide? Maybe it can stop somebody to do it..

Thanks for your help...
(I also found this topic but I was making couple of test using different commands like setacl and pw...wrong way :) )
I won't be adding it to the guide cause UNIX is what it is set to by default. I assume anyone who waivers from the guide knows the consequences of their modifications.
 

ZDrt

Cadet
Joined
Jan 19, 2015
Messages
9
your guide, your decision...but according to the topic you mentioned this is a little fault of freenas that there is no way how to change permisions...
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
your guide, your decision...but according to the topic you mentioned this is a little fault of freenas that there is no way how to change permisions...
I figure since it has something to do with Windows so it was irrelevant to the guide.
 

Chakalov

Explorer
Joined
Feb 9, 2015
Messages
53
I was wondering if the period of how often a folder is synchronised with the server is adjustable? I mean if it is possible to make sync changes more often (more rapidly) for example in a shared folder so others could sooner see the changes on their computer.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
I was wondering if the period of how often a folder is synchronised with the server is adjustable? I mean if it is possible to make sync changes more often (more rapidly) for example in a shared folder so others could sooner see the changes on their computer.
That would need to be configured on the client end. I would check the docs for your client or ask on the OC forums.
 

csjjpm

Contributor
Joined
Feb 16, 2015
Messages
126
Hi, I get this too. I've tried 'portsnap fetch update' and then 'make install clean...' again but get the same error.
Any other ideas?
thanks
Paul

Hey guys, just wondering if anyone had ever run into this compile error when running "make install clean -C /usr/ports/devel/pecl-APCu". I've been trying to hunt down the issue, but haven't had any success yet. Running FreeNAS 9.2.1.8, error log below:
Code:
/bin/sh /usr/ports/devel/pecl-APCu/work/apcu-4.0.2/libtool --mode=compile cc  -I. -I/usr/ports/devel/pecl-APCu/work/apcu-4.0.2 -DPHP_ATOM_INC -I/usr/ports/devel/pecl-APCu/work/apcu-4.0.2/include -I/usr/ports/devel/pecl-APCu/work/apcu-4.0.2/main -I/usr/ports/devel/pecl-APCu/work/apcu-4.0.2 -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -O2 -pipe -I/usr/local/include -fno-strict-aliasing   -c /usr/ports/devel/pecl-APCu/work/apcu-4.0.2/apc_cache.c -o apc_cache.lo
/bin/sh /usr/ports/devel/pecl-APCu/work/apcu-4.0.2/libtool --mode=compile cc  -I. -I/usr/ports/devel/pecl-APCu/work/apcu-4.0.2 -DPHP_ATOM_INC -I/usr/ports/devel/pecl-APCu/work/apcu-4.0.2/include -I/usr/ports/devel/pecl-APCu/work/apcu-4.0.2/main -I/usr/ports/devel/pecl-APCu/work/apcu-4.0.2 -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -O2 -pipe -I/usr/local/include -fno-strict-aliasing   -c /usr/ports/devel/pecl-APCu/work/apcu-4.0.2/apc_stack.c -o apc_stack.lo
cc -I. -I/usr/ports/devel/pecl-APCu/work/apcu-4.0.2 -DPHP_ATOM_INC -I/usr/ports/devel/pecl-APCu/work/apcu-4.0.2/include -I/usr/ports/devel/pecl-APCu/work/apcu-4.0.2/main -I/usr/ports/devel/pecl-APCu/work/apcu-4.0.2 -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -O2 -pipe -I/usr/local/include -fno-strict-aliasing -c /usr/ports/devel/pecl-APCu/work/apcu-4.0.2/apc_cache.c  -fPIC -DPIC -o .libs/apc_cache.o
cc -I. -I/usr/ports/devel/pecl-APCu/work/apcu-4.0.2 -DPHP_ATOM_INC -I/usr/ports/devel/pecl-APCu/work/apcu-4.0.2/include -I/usr/ports/devel/pecl-APCu/work/apcu-4.0.2/main -I/usr/ports/devel/pecl-APCu/work/apcu-4.0.2 -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -O2 -pipe -I/usr/local/include -fno-strict-aliasing -c /usr/ports/devel/pecl-APCu/work/apcu-4.0.2/apc_stack.c  -fPIC -DPIC -o .libs/apc_stack.o
/usr/ports/devel/pecl-APCu/work/apcu-4.0.2/apc_cache.c: In function 'apc_cache_update':
/usr/ports/devel/pecl-APCu/work/apcu-4.0.2/apc_cache.c:1113: error: 'IS_CONSTANT_INDEX' undeclared (first use in this function)
/usr/ports/devel/pecl-APCu/work/apcu-4.0.2/apc_cache.c:1113: error: (Each undeclared identifier is reported only once
/usr/ports/devel/pecl-APCu/work/apcu-4.0.2/apc_cache.c:1113: error: for each function it appears in.)
/usr/ports/devel/pecl-APCu/work/apcu-4.0.2/apc_cache.c:1115: error: 'IS_CONSTANT_ARRAY' undeclared (first use in this function)
/usr/ports/devel/pecl-APCu/work/apcu-4.0.2/apc_cache.c: In function 'my_serialize_object':
/usr/ports/devel/pecl-APCu/work/apcu-4.0.2/apc_cache.c:1236: error: 'IS_CONSTANT_INDEX' undeclared (first use in this function)
/usr/ports/devel/pecl-APCu/work/apcu-4.0.2/apc_cache.c: In function 'my_copy_zval':
/usr/ports/devel/pecl-APCu/work/apcu-4.0.2/apc_cache.c:1469: error: 'IS_CONSTANT_ARRAY' undeclared (first use in this function)
/bin/sh /usr/ports/devel/pecl-APCu/work/apcu-4.0.2/libtool --mode=compile cc  -I. -I/usr/ports/devel/pecl-APCu/work/apcu-4.0.2 -DPHP_ATOM_INC -I/usr/ports/devel/pecl-APCu/work/apcu-4.0.2/include -I/usr/ports/devel/pecl-APCu/work/apcu-4.0.2/main -I/usr/ports/devel/pecl-APCu/work/apcu-4.0.2 -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -O2 -pipe -I/usr/local/include -fno-strict-aliasing   -c /usr/ports/devel/pecl-APCu/work/apcu-4.0.2/apc_rfc1867.c -o apc_rfc1867.lo
*** [apc_cache.lo] Error code 1
cc -I. -I/usr/ports/devel/pecl-APCu/work/apcu-4.0.2 -DPHP_ATOM_INC -I/usr/ports/devel/pecl-APCu/work/apcu-4.0.2/include -I/usr/ports/devel/pecl-APCu/work/apcu-4.0.2/main -I/usr/ports/devel/pecl-APCu/work/apcu-4.0.2 -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -O2 -pipe -I/usr/local/include -fno-strict-aliasing -c /usr/ports/devel/pecl-APCu/work/apcu-4.0.2/apc_rfc1867.c  -fPIC -DPIC -o .libs/apc_rfc1867.o
1 error
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** [do-build] Error code 1

Stop in /usr/ports/devel/pecl-APCu.
 

csjjpm

Contributor
Joined
Feb 16, 2015
Messages
126
Ok, you've suggested this as well, this worked. Thanks

EDIT: I also had to perform a 'portsnap fetch update' or 'portsnap extract' (cant remember which) before this command would work
'make install clean -C /usr/ports/devel/pecl-intl'

Paul

try this to get past the issue
Code:
pkg install autoconf
 
Last edited:

Chakalov

Explorer
Joined
Feb 9, 2015
Messages
53
Does anyone have any idea why 'trashbin_retention_obligation' option in OC config.php isn't working? I would really like to auto-trash all deleted files after some period of time.
 

csjjpm

Contributor
Joined
Feb 16, 2015
Messages
126
Hi,
I completed install and followed the earlier post to make it a owncloud.mydomain.com but when I go to the webgui I am prompted to download an octet file. This is my nginx.conf
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/owncloud;  
          location = /robots.txt { allow all; access_log off; log_not_found off; }
          location = /favicon.ico { access_log off; log_not_found off; }  
                  index index.php;  
                  try_files $uri $uri/ /index.php$is_args$args;  
                  client_max_body_size 512M;  
                  location ~ ^/(?:\.|data|config|db_structure\.xml|README) {  
                      deny all;  
                  }  
                  location \.php(?:$|/) {  
                      fastcgi_split_path_info ^(.+\.php)(/.*)$;  
                      fastcgi_pass unix:/var/run/php-fpm.sock;
                      fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;  
                     fastcgi_param PATH_INFO $fastcgi_path_info;  
                      include fastcgi_params;  
                      fastcgi_param MOD_X_ACCEL_REDIRECT_ENABLED on;  
                  }  
                  location \.(?:jpg|gif|ico|png|css|js|svg)$ {
                      expires 30d; add_header Cache-Control public;  
                  }  
                  location ^/data {  
                      internal;  
                      alias /mnt/files;  
                  }  
              }  
      }


If I use the original conf I get this error
ervice nginx restart
Performing sanity check on nginx configuration:
nginx: [emerg] location "^/owncloud/(?:\.|data|config|db_structure\.xml|README)" is outside location "/owncloud" in /usr/local/etc/n
ginx/nginx.conf:22
nginx: configuration file /usr/local/etc/nginx/nginx.conf test failed
 
Top