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)

[root@myhost php]# pwd
[root@myhost 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:

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

[root@myhost ~]# usermod -G apache -a owncloud



Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.

You May Also Like…