After successfully installing Nextcloud 13.0.4 on CentOS 7 running NGINX and PHP 7.2, I was unable to login with the admin account that was created during the installation. I entered the credentials and hit “Log in” and it looked like the Nextcloud page refreshed and redirected to http://x.x.x.x/login?redirect_url=/apps/files/. No error message was found in nextcloud.log, /var/log/messages or /var/log/nginx/error.log.
I spent a great number of hours troubleshooting the issues and at one point I considered downgrading PHP to a earlier version, however I was able to find a solution.
If you’re on NGINX find out which user NGINX is running under:
cat /etc/nginx/nginx.conf | grep user
I’m running NGINX as user “nginx”.
cd /var/lib/php/fpm/
Use “ls” or “dir” command to check if the following directories exist on your system:
– session
– wsdlcache
– opcache
If the directories don’t exist, create them:
mkdir session
mkdir wsdlcache
mkdir opcache
Change the ownership of these directories to the appropriate user.
chown nginx:nginx /var/lib/php/fpm/session/
chown root:nginx /var/lib/php/fpm/wsdlcache/
chown root:nginx /var/lib/php/fpm/opcache/
Restart NGINX / Apache and PHP:
service nginx restart
service php-fpm restart
Now you should be able to login to Nextcloud with the admin user you created during the installation.
I recommend installing redis and opcache so data can be cached in RAM to improve performance.
Hope this saved you time in your journey to get Nextcloud up and running.