A
A
alizhakupov2020-02-14 06:41:36
Digital certificates
alizhakupov, 2020-02-14 06:41:36

Why is there a 404 error when the file is in the directory?

Hello!
Such a problem: I tried to get an ssl certificate for the site - for this I created two
.well-known folders in the root and acme-challenge in it and threw the file into the last one without specifying the extension.

When you try to check the file, you get a 404 error despite the fact that it is in the directory.
I tried to throw it in the directory above, i.e. in .-well-known , then it is visible.
What could be the problem please

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
granty, 2020-02-14
@alizhakupov

1. Check the permissions on the acme-challenge folder, the webserver may not be allowed to read them. You need '-rx' for the user under which the web server (or its groups) is running.
2. The web server config must contain

Alias /.well-known/acme-challenge/ /u/www/virtual/letsencrypt/.well-known/acme-challenge/

and
<Directory "/ваш путь на сервере/.well-known/acme-challenge/">
    Options None
    AllowOverride None
    ForceType text/plain
    Order allow,deny
    Allow from all
    RedirectMatch 404 "^(?!/\.well-known/acme-challenge/[\w-]{43}$)"
</Directory>

3. your "file without extension" does not fall under the regular expression
RedirectMatch 404 "^(?!/\.well-known/acme-challenge/[\w-]{43}$)"

comment out this line and restart the webserver - the file should show up. But then uncomment it back, it's protection from "hackers".

P
Page-Audit.ru, 2020-02-14
@PageAuditRU

# Пусть .weel-known лежит в папке /var/www/letsencrypt
    location /.well-known {
        allow           all;
        root            /var/www/letsencrypt;
    }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question