Can't log in to nextcloud page with any user

Nextcloud version: ‘version’ => ‘18.0.1.3’,
Operating system and version (eg, Ubuntu 20.04): Red Hat Enterprise Linux release 8.2 (Ootpa)
Apache or nginx version (eg, Apache 2.4.25): nginx version: nginx/1.14.1
PHP version (eg, 7.1): PHP 7.2.24 (cli)

The issue you are facing:
I can’t logon to nextcloud anymore. When adding a desktop nextcloud client, it will not let me authorizie. It seems that any other webpage than the login page will not display. I type login credentials and andn press login the the URL changes to

https://fqdn/login?redirect_url=/apps/files/

but the login screen is shown. nextlcoud log shows:

{"reqId":"qY0q7tTjOUNf0uYAVIHN","level":0,"time":"2020-05-29T22:08:18+00:00","remoteAddr":"REVERSE_PROXY_INTERNAL_IP","user":"--","app":"core","method":"GET","url":"/apps/files/","message":{"Exception":"OC\\AppFramework\\Middleware\\Security\\Exceptions\\NotLoggedInException","Message":"Current user is not logged in","Code":401,"Trace":[{"file":"/usr/share/nginx/nextcloud/lib/private/AppFramework/Middleware/MiddlewareDispatcher.php","line":97,"function":"beforeController","class":"OC\\AppFramework\\Middleware\\Security\\SecurityMiddleware","type":"->","args":[{"__class__":"OCA\\Files\\Controller\\ViewController"},"index"]},{"file":"/usr/share/nginx/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":98,"function":"beforeController","class":"OC\\AppFramework\\Middleware\\MiddlewareDispatcher","type":"->","args":[{"__class__":"OCA\\Files\\Controller\\ViewController"},"index"]},{"file":"/usr/share/nginx/nextcloud/lib/private/AppFramework/App.php","line":125,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Files\\Controller\\ViewController"},"index"]},{"file":"/usr/share/nginx/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php","line":47,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Files\\Controller\\ViewController","index",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"_route":"files.view.index"}]},{"function":"__invoke","class":"OC\\AppFramework\\Routing\\RouteActionHandler","type":"->","args":[{"_route":"files.view.index"}]},{"file":"/usr/share/nginx/nextcloud/lib/private/Route/Router.php","line":299,"function":"call_user_func","args":[{"__class__":"OC\\AppFramework\\Routing\\RouteActionHandler"},{"_route":"files.view.index"}]},{"file":"/usr/share/nginx/nextcloud/lib/base.php","line":1008,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/files/"]},{"file":"/usr/share/nginx/nextcloud/index.php","line":38,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/usr/share/nginx/nextcloud/lib/private/AppFramework/Middleware/Security/SecurityMiddleware.php","Line":142,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko","version":"18.0.1.3"}

Please note that while the IP was redacted, the user was not. User shows as “—”.

Is this the first time you’ve seen this error? (Y/N): Yes -after a longer time of it just working, and me not touching it, it stopped working. Things that may have changed in between is the certbot cert, and red hat updates. I can’t think of anything else, all of these should happen automatically.

Steps to replicate it: I don’t know.

The output of your Nextcloud log in Admin > Logging:

NO access to web interface.

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

don't understand. Data directory? 

The output of your Apache/nginx/system log in /var/log/____:

no errors 

This fixed it for me:
Source: https://help.nextcloud.com/t/fresh-install-of-11-0-1-login-loop/8724/8

chown nginx:nginx /var/lib/php/session/
chown root:nginx /var/lib/php/wsdlcache/
chown root:nginx /var/lib/php/opcache/