4

I'm trying to set up a let's encrypt cert with a store view in Magento 2.4.1, but I can't access the .well-known/acme-challenge directory.

In the Apache 2.4 virtual host, I have:

<VirtualHost>
...
#==== LET'S ENCRYPT ====
<Directory "/usr/local/www/apache24/webroot/company/.well-known/acme-challenge">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
...
<VirtualHost>

But I'm getting a 404 not found when trying to access the Magento storeview .well-known URL:

http://www.example.com/.well-known/acme-challenge/

Do I need to make any changes to Magento2 to be able to access dot named directories?

Thanks,

Aknot
  • 205

2 Answers2

2

You need to add the .well-know folder inside the pub folder of your Magento installation and add a .htaccess file in your case, as you're using Apache.

/usr/local/www/apache24/webroot/company/pub/.well-known/acme-challenge

It will be accessible via http://www.example.com/.well-known/acme-challenge/

2

You can add RewriteCond %{REQUEST_URI} !^/.well-known/ to .htaccess at the top where Magento's own bypasses are

RewriteEngine on
RewriteCond %{REQUEST_URI} !^/pub/
RewriteCond %{REQUEST_URI} !^/setup/
RewriteCond %{REQUEST_URI} !^/update/
RewriteCond %{REQUEST_URI} !^/dev/
RewriteCond %{REQUEST_URI} !^/.well-known/
RewriteRule .* /pub/$0 [L]
Deggial
  • 21