У меня есть приложение Next. JS, размещенное на Linode с использованием nginx и pm2.
Когда я пытаюсь обновить свой сертификат, я запускаю следующую команду:
sudo letsencrypt certonly -a webroot --webroot-path=/var/www/project -d example.com -d www.example.com
Однако это приводит к сбою некоторых проблем, в частности к этой ошибке:
IMPORTANT NOTES:
- The following errors were reported by the server:
Domain: example.com
Type: unauthorized
Detail: Invalid response from
https://example.com/.well-known/acme-challenge/tdrjf7xqYmTEcZUGxfpDQ179XVA55wcaV6de30nMlJE
[2a01:7e01::f03c:92ff:fefb:29]: "<html>\r\n<head><title>404 Not
Found</title></head>\r\n<body>\r\n<center><h1>404 Not
Found</h1></center>\r\n<hr><center>nginx/1.16.1 (Ub"
Domain: www.example.com
Type: unauthorized
Detail: Invalid response from
https://example.com/.well-known/acme-challenge/AlIotwMFT_m-mlPvlg30Ya2r4sFm6qxLjZxjnBmmOJA
[2a01:7e01::f03c:92ff:fefb:29]: "<html>\r\n<head><title>404 Not
Found</title></head>\r\n<body>\r\n<center><h1>404 Not
Found</h1></center>\r\n<hr><center>nginx/1.16.1 (Ub"
To fix these errors, please make sure that your domain name was
entered correctly and the DNS A/AAAA record(s) for that domain
contain(s) the right IP address.
Теперь я не уверен, нужно ли мне настраивать что-то еще в Linode или что-то еще. Кто-нибудь знает, что мне нужно делать?
Вот моя nginx настройка:
# redirect http to https
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name example.com www.example.com;
return 301 https://$server_name$request_uri;
}
server {
# listen on *:443 -> ssl; instead of *:80
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
server_name example.com;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
include snippets/ssl-params.conf;
location / {
# reverse proxy for next server
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
# we need to remove this 404 handling
# because next's _next folder and own handling
# try_files $uri $uri/ =404;
}
location ~ /.well-known {
allow all;
}
}