OwnCloud – Redirect Loop under CentOS

Written by James McDonald

June 5, 2012

If you get a redirect loop while running owncloud under nginx

It may be because /var/lib/php/session doesn’t exist http://possiblelossofprecision.net/?p=1774

Or if it does you may be suffering from a permission issue caused by /usr/lib/php/session being owned by root:apache instead of the user running php-fpm (usually nginx)

[[email protected] php]# pwd
[[email protected] php]# ls -al
total 40
drwxr-xr-x  3 root root    4096 Jun 27 11:59 .
drwxr-xr-x 26 root root    4096 Jun 21 00:14 ..
drwxrwx---  2 root apache 32768 Aug  5 19:12 session

The fix for this can be to change the permissions for the nginx user so it is a member of the apache group:

usermod -G apache -a nginx

Make sure you specify the -a switch to append the nginx user account to the apache group, thus keeping the nginx user accounts other group memberships.

If you are running php-fpm as another user substitute nginx for the other user e.g:

[[email protected] ~]# ps -ef | grep php-fpm
owncloud    1303  1222  0 19:12 ?        00:00:00 php-fpm: pool owncloud.jamesmcdonald.id.au

[[email protected] ~]# usermod -G apache -a owncloud



Submit a Comment

Your email address will not be published.

You May Also Like…

PHP Iterators

Just came across a Youtube talk "Iterators in PHP" by Jake Smith published in 2014 that steps through the many...

PHP array_map Multiple Arrays

array_map can take multiple arrays. I like how it starts mapping through them starting at the first element of each...