Estou tentando configurar uma instância do Mastodon no Ubuntu 22.04. Configurei o Nginx como proxy reverso e agora estou tentando gerar um certificado SSL com Let's Encrypt. Quando executo certbot --nginx -d pacsa.us -v
, recebo esta saída:
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx
Requesting a certificate for pacsa.us
Performing the following challenges:
http-01 challenge for pacsa.us
Waiting for verification...
Challenge failed for domain pacsa.us
http-01 challenge for pacsa.us
Certbot failed to authenticate some domains (authenticator: nginx). The Certificate Authority reported these problems:
Domain: pacsa.us
Type: unauthorized
Detail: 94.23.75.107: Invalid response from http://pacsa.us/.well-known/acme-challenge/LnWLQH7GlWEN4ODIF7Eh_8CLOUGhyOc5ZuHfu9LRexI: 404
Hint: The Certificate Authority failed to verify the temporary nginx configuration changes made by Certbot. Ensure the listed domains point to this nginx server and that it is accessible from the internet.
Cleaning up challenges
Some challenges have failed.
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.
Esta é a aparência do bloco do servidor da porta 80 em /etc/nginx/conf.d/mastodon.conf
:
server {
listen 80;
listen [::]:80;
server_name pacsa.us;
root /home/mastodon/public;
location /.well-known/acme-challenge/ { allow all; }
location / { return 301 https://$host$request_uri; }
}
O erro indica que a solicitação de desafio Let's Encrypt não está sendo atendida corretamente pelo Nginx.
Certifique-se de que seu domínio pacsa.us esteja apontado corretamente para o endereço IP do seu servidor . Você pode usar ferramentas como dig ou verificadores de DNS online para confirmar isso.
Certifique-se de que o bloco de localização .well-known/acme-challenge esteja corretamente configurado e acessível. Sua configuração parece quase correta, mas certifique-se de que não haja erros de digitação ou configurações incorretas.
Certifique-se de que o Nginx tenha acesso de leitura ao diretório .well-known/acme-challenge
Teste manualmente criando um arquivo de teste no diretório .well-known/acme-challenge/ e veja se você pode acessá-lo via http://pacsa.us/.well-known/acme-challenge/test-file . Caso contrário, o Nginx não está servindo os arquivos desse diretório corretamente.
Tente simplificar a configuração assim:
Reinicie o Nginx e tente:
Se eu pudesse ver alguns registros, seria mais fácil identificar o que está errado.
Boa sorte!