Internal server error when user logs in

Steps to reproduce
1. login to the server as a user

Expected behaviour
The user shoud log in successfully.

Actual behaviour
The user met an internal server error. I still can log as admin.

Server configuration
Operating system: debian 8.0
Web server: apache 2.4.10-10+deb8u7
Database: Mariadb 10.0.27+maria-1~jessie
PHP version: 5.6.27+dfsg-0+deb8u1
ownCloud version (see ownCloud admin page): 9.1.1-1.2
Special configuration (external storage, external authentication, reverse proxy, server-side-encryption):
external storage, external authentifcation and server-side-encryption enable
ownCloud log (data/owncloud.log)

Error     index
Exception: {"Exception":"OCP\\Files\\NotFoundException","Message":"","Code":0,"Trace":"#0 \/var\/www\/cloud.domain.ltd\/lib\/private\/Files\/Node\/Node.php(222): OC\\Files\\Node\\Node->getFileInfo()\n#1 \/var\/www\/cloud.domain.ltd\/lib\/private\/Files\/Node\/Node.php(105): OC\\Files\\Node\\Node->getPermissions()\n#2 \/var\/www\/cloud.domain.ltd\/lib\/private\/Files\/Node\/Folder.php(139): OC\\Files\\Node\\Node->checkPermissions(4)\n#3 \/var\/www\/cloud.domain.ltd\/lib\/private\/Files\/Node\/Root.php(351): OC\\Files\\Node\\Folder->newFolder('\/files')\n#4 \/var\/www\/cloud.domain.ltd\/lib\/private\/Server.php(809): OC\\Files\\Node\\Root->getUserFolder('user')\n#5 \/var\/www\/cloud.domain.ltd\/lib\/private\/User\/Session.php(384): OC\\Server->getUserFolder('user')\n#6 \/var\/www\/cloud.domain.ltd\/lib\/private\/User\/Session.php(438): OC\\User\\Session->prepareUserLogin()\n#7 \/var\/www\/cloud.domain.ltd\/lib\/private\/User\/Session.php(287): OC\\User\\Session->loginWithPassword(*** sensitive parameters replaced ***)\n#8 \/var\/www\/cloud.domain.ltd\/core\/Controller\/LoginController.php(196): OC\\User\\Session->login(*** sensitive parameters replaced ***)\n#9 [internal function]: OC\\Core\\Controller\\LoginController->tryLogin(*** sensitive parameters replaced ***)\n#10 \/var\/www\/cloud.domain.ltd\/lib\/private\/AppFramework\/Http\/Dispatcher.php(159): call_user_func_array(Array, Array)\n#11 \/var\/www\/cloud.domain.ltd\/lib\/private\/AppFramework\/Http\/Dispatcher.php(89): OC\\AppFramework\\Http\\Dispatcher->executeController(Object(OC\\Core\\Controller\\LoginController), 'tryLogin')\n#12 \/var\/www\/cloud.domain.ltd\/lib\/private\/AppFramework\/App.php(110): OC\\AppFramework\\Http\\Dispatcher->dispatch(Object(OC\\Core\\Controller\\LoginController), 'tryLogin')\n#13 \/var\/www\/cloud.domain.ltd\/lib\/private\/AppFramework\/Routing\/RouteActionHandler.php(46): OC\\AppFramework\\App::main('LoginController', 'tryLogin', Object(OC\\AppFramework\\DependencyInjection\\DIContainer), Array)\n#14 [internal function]: OC\\AppFramework\\Routing\\RouteActionHandler->__invoke(Array)\n#15 \/var\/www\/cloud.domain.ltd\/lib\/private\/Route\/Router.php(280): call_user_func(Object(OC\\AppFramework\\Routing\\RouteActionHandler), Array)\n#16 \/var\/www\/cloud.domain.ltd\/lib\/base.php(891): OC\\Route\\Router->match('\/login')\n#17 \/var\/www\/cloud.domain.ltd\/index.php(39): OC::handleRequest()\n#18 {main}","File":"\/var\/www\/cloud.domain.ltd\/lib\/private\/Files\/Node\/Node.php","Line":85}
2016-10-29T00:34:43+00:00
Error     PHP     
opendir(/var/www/cloud.domain.ltd/data/user/cache): failed to open dir: Permission denied at /var/www/cloud.domain.ltd/lib/private/Files/Storage/Local.php#116
2016-10-29T00:34:42+00:00

Apache PHP logfile:

[Sat Oct 29 02:58:38.90727 2016] [core:alert] [pid 13651] [client IP:59364 /var/www/cloud.domain.ltd/data/.htaccess: Expected </IfModule> before end of configuration

Integrity status for oC9+

No errors have been found.

It looks quite similar to this issue (The requested uri(\/login) cannot be processed by the script ‘\/owncloud\/index.php’) but I don't have the same log error.

EDIT: I tried # chmod o+rx cache. I don't get the php error which fails to open the directory. However, I still have the index error. My created users can not log in.

Can you post this file? There seems to be a syntax error (did you modify it?).

Besides the mentioned .htaccess also fix the permission issue on:

/var/www/cloud.domain.ltd/data/user/cache

My .htaccess was wrong so I put a new one from the owncloud website:

<IfModule mod_headers.c>
  <IfModule mod_setenvif.c>
    <IfModule mod_fcgid.c>
       SetEnvIfNoCase ^Authorization$ "(.+)" XAUTHORIZATION=$1
       RequestHeader set XAuthorization %{XAUTHORIZATION}e env=XAUTHORIZATION
    </IfModule>
    <IfModule mod_proxy_fcgi.c>
       SetEnvIfNoCase Authorization "(.+)" HTTP_AUTHORIZATION=$1
    </IfModule>
  </IfModule>
  <IfModule mod_env.c>
    # Add security and privacy related headers
    Header set X-Content-Type-Options "nosniff"
    Header set X-XSS-Protection "1; mode=block"
    Header set X-Robots-Tag "none"
    Header set X-Frame-Options "SAMEORIGIN"
    Header set X-Download-Options "noopen"
    Header set X-Permitted-Cross-Domain-Policies "none"
    SetEnv modHeadersAvailable true
  </IfModule>
  # Add cache control for CSS and JS files
  <FilesMatch "\.(css|js)$">
    Header set Cache-Control "max-age=7200, public"
  </FilesMatch>
</IfModule>
<IfModule mod_php5.c>
  php_value upload_max_filesize 513M
  php_value post_max_size 513M
  php_value memory_limit 512M
  php_value mbstring.func_overload 0
  php_value always_populate_raw_post_data -1
  php_value default_charset 'UTF-8'
  php_value output_buffering 0
  <IfModule mod_env.c>
    SetEnv htaccessWorking true
  </IfModule>
</IfModule>
<IfModule mod_php7.c>
  php_value upload_max_filesize 513M
  php_value post_max_size 513M
  php_value memory_limit 512M
  php_value mbstring.func_overload 0
  php_value default_charset 'UTF-8'
  php_value output_buffering 0
  <IfModule mod_env.c>
    SetEnv htaccessWorking true
  </IfModule>
</IfModule>
<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  RewriteRule ^\.well-known/host-meta /public.php?service=host-meta [QSA,L]
  RewriteRule ^\.well-known/host-meta\.json /public.php?service=host-meta-json [QSA,L]
  RewriteRule ^\.well-known/carddav /remote.php/dav/ [R=301,L]
  RewriteRule ^\.well-known/caldav /remote.php/dav/ [R=301,L]
  RewriteRule ^remote/(.*) remote.php [QSA,L]
  RewriteRule ^(?:build|tests|config|lib|3rdparty|templates)/.* - [R=404,L]
  RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge/.*
  RewriteRule ^(?:\.|autotest|occ|issue|indie|db_|console).* - [R=404,L]
</IfModule>
<IfModule mod_mime.c>
  AddType image/svg+xml svg svgz
  AddEncoding gzip svgz
</IfModule>
<IfModule mod_dir.c>
  DirectoryIndex index.php index.html
</IfModule>
AddDefaultCharset utf-8
Options -Indexes
<IfModule pagespeed_module>
  ModPagespeed Off
</IfModule>

I don't have error anymore in the owncloud scan but my created users can not log in (only the admin can).

Sorry for my misleading post. It was not a solution. It is the content of my actual .htaccess in /var/www/cloud.domain.ltd/ directory.

So lets close this then as two of the three different issues in here (.htaccess and permissions) are solved. This avoids that people are posting the well known "i have the same problem" or "same here" posts and just starting a messy thread with that.

For your issue about the users not able to login please create a new thread. When doing so please:

  1. Explain exactly "but my created users can not log in" as this contains no information what happening if these users are trying to login
  2. Empty your data/owncloud.log to make sure that you don't have any log entries of your previous solved issues in there.