3

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,

3
  • 1
    Check, what you got in apache logs when try setup cert? If I don't made a mistake this directives: "Order allow,deny", "Allow from all" can be used in compatibility mode in apache 2.4 but are deprecated too.
    – mariaczi
    Oct 20, 2020 at 7:51
  • What is the rest of the Apache configuration? Oct 20, 2020 at 16:21
  • @Michael Works now, it could have been a cache issue, we don't know exactly.
    – Aknot
    Oct 21, 2020 at 7:12

2 Answers 2

1

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/

1

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]

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .