nextcloud_ynh icon indicating copy to clipboard operation
nextcloud_ynh copied to clipboard

internal Server Error (reloded)

Open rocky-III opened this issue 2 years ago • 2 comments

It was working for a while but now i have this internal Server Error again - i can´t login it is like here: https://github.com/YunoHost-Apps/nextcloud_ynh/issues/313

/var/log/nginx/cloud.xyz.tld-error.log shows me:

2021/12/14 11:07:42 [error] 7077#7077: *67399 open() "/usr/share/nginx/html/.well-known/caldav" failed (2: No such file or directory), client: 127.0.0.1, server: cloud.xyz.tld, request: "GET /.well-known/caldav HTTP/2.0", host: "cloud.xyz.tld"
2021/12/14 11:07:42 [error] 7077#7077: *67400 open() "/usr/share/nginx/html/.well-known/carddav" failed (2: No such file or directory), client: 127.0.0.1, server: cloud.xyz.tld, request: "GET /.well-known/carddav HTTP/2.0", host: "cloud.xyz.tld"
2021/12/14 11:10:38 [crit] 8006#8006: *67480 stat() "/var/www/nextcloud/index.php" failed (13: Permission denied), client: xx.yy.143.211, server: cloud.xyz.tld, request: "GET /index.php/csrftoken HTTP/2.0", host: "cloud.xyz.tld"

/usr/share/nginx/html/.well-known/caldav and /usr/share/nginx/html/.well-known/carddav

have be created by me now... but that does not help..

what could I try next? THANKS for help

rocky-III avatar Dec 14 '21 12:12 rocky-III

to /etc/nginx/conf.d/domain.tld.d/nextcloud.conf add at the begining... (Change domain.tld with your domain of course)

" .... cut here till location ^~ /.well-known { # The following 6 rules are borrowed from .htaccess

# The following 2 rules are only needed for the user_webfinger app. # Uncomment it if you're planning to use this app. #rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last; #rewrite ^/.well-known/host-meta /public.php?service=host-meta last;

location = /.well-known/carddav { return 301 /remote.php/dav/; } location = /.well-known/caldav { return 301 /remote.php/dav/; }

location = /.well-known/webfinger { return 301 /index.php$uri; } location = /.well-known/nodeinfo { return 301 /index.php$uri; }

try_files $uri $uri/ =404; } " here is the end. It's a common known recipe... and works

@rocky-III clouse the issue if this works...

By the way... it asume that you are using nextcloud at / not in a directory, not domain.tld/nextcloud... for that you need to tame it a little.

" .... cut here till location ^~ /nextcloud/.well-known { # The following 6 rules are borrowed from .htaccess

# The following 2 rules are only needed for the user_webfinger app. # Uncomment it if you're planning to use this app. #rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last; #rewrite ^/.well-known/host-meta /public.php?service=host-meta last;

location = /nextcloud/.well-known/carddav { return 301 /nextcloud/remote.php/dav/; } location = /nextcloud/.well-known/caldav { return 301 /nextcloud/remote.php/dav/; }

location = /nextcloud/.well-known/webfinger { return 301 /nextcloud/index.php$uri; } location = /nextcloud/.well-known/nodeinfo { return 301 /nextcloud/index.php$uri; }

try_files $uri $uri/ =404; } " here is the end.

Just as simple as that... but I do recommend you to use a nextcloud.domain.tld ... not domain.tld/nextcloud

None the less, you should never forget that after changing something that affect the nginx configuration "sudo systemctl restart nginx" and "sudo systemctl status" to check if everything is ok...

bjarkan avatar Dec 16 '21 01:12 bjarkan

@bjarkan - Thanks but

in /etc/nginx/conf.d/domain.tld.d/nextcloud.conf i see already the code

location ^~ /.well-known {
  # The following 6 rules are borrowed from `.htaccess`

  # The following 2 rules are only needed for the user_webfinger app.
  # Uncomment it if you're planning to use this app.
  #rewrite ^/\.well-known/host-meta\.json  /public.php?service=host-meta-json  last;
  #rewrite ^/\.well-known/host-meta        /public.php?service=host-meta       last;

  location = /.well-known/carddav     { return 301 /remote.php/dav/; }
  location = /.well-known/caldav      { return 301 /remote.php/dav/; }
 
  location = /.well-known/webfinger     { return 301 /index.php$uri; }
  location = /.well-known/nodeinfo      { return 301 /index.php$uri; }

  try_files $uri $uri/ =404;
}

But it does not help What else could I try ?

rocky-III avatar Feb 17 '22 17:02 rocky-III

Closing, as the issue is stale and hopefully solved. Feel free to reopen if needed.

tituspijean avatar Oct 16 '23 09:10 tituspijean