Owncloud, change from selfsigned to LE

Hi,

when I try to validate the domain then letsencrypt cannot find the directory
.well-known/acme-challenge

there is a rewrite in the .htaccess from Owncloud.

RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

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/carddav/ [R=301,L]
RewriteRule ^.well-known/caldav /remote.php/caldav/ [R=301,L]

If I try to put a plain textfile in .well-known/acme-challenge the I cannot find this file.

Befor I do something would it be possible to add a rewrite rule so .well-known/acme-challenge
can be read? Did anyone already did that?

Kind regards,
Jan

Hi Jan,

non of those rules should affect your ability to reach a text file in .well-known/acme-challenge

Do you get a “404” error - file not found. or do you get a redirect ? if so, where to.

Hi

thanks for the very fast response!

I get a redirect to an owncloud page telling me it could not find the file.
To what oc-file i am redirected is unclear to me for now.

Regards,
Jan

Just checked my owncloud .htaccess and it’s almost identical (and works)

The only difference ( although I don’t see would make much difference) is I don’t redirect to https for the acme-challenge

RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge/
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Are you happy to give the URL ( or PM me the url ) and I can see what the redirects are

1 Like

I think I send a PM.

Regards,
Jan

Thanks to serverco

I took the easy way.

renamed .htaccess to temp.htaccess
ran letsencrypt without problems, copied the certs and key in plesk
renamed temp.htaccess to .htaccess

Done

I now have a LE certificate.

Regards,
Jan

1 Like

There are several topics about Owncloud already created. So I assume Owncloud somehow redirects the LE .well-known request where it should not.
Here are two topics:

Fortunately the latter is also solved and proposes a change in the .htaccess.
Maybe someone might take this instructions into the LE or the Owncloud FAQ or even change the default OwnCloud config. This would prevent this error in the first place.