Answer the question
In order to leave comments, you need to log in
How to pass Let's Encrypt verification or serve file with nginx using nodejs?
I'm trying to get a certificate from Let's Encrypt, but the verification fails.
./letsencrypt-auto certonly --webroot -w /home/user/www/domane.ru/ -d domain.ru
server {
listen 80;
listen [::]:80;
server_name domane.ru;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://127.0.0.1:4567/;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
root /home/user/www/domane.ru;
location ~ /.well-known/acme-challenge/(.*)
{
default_type "text/plain";
root /home/user/www/domane.ru;
}
Answer the question
In order to leave comments, you need to log in
I do so
it can be put in cron at once. Only if you have many domains, keep in mind that they have limits. And the limits are quite small.
letsencrypt.conf
location /.well-known/acme-challenge {
root /home/ubuntu/.lets;
}
/etc/nginx/sites-enabled/domain.com
server {
listen 80;
server_name domain.com;
include letsencrypt.conf;
include redirect.conf;
}
redirect.conf
if ($host ~* ^www\.(.*)$) {
return 301 https://$1$request_uri;
}
return 301 https://$host$request_uri;
server {
listen 443 ssl http2;
server_name domain.com;
ssl_certificate /etc/letsencrypt/live/domain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/domain.com/privkey.pem;
include sslplus.conf;
location / {
include nodejs.conf;
proxy_pass http://10.3.100.1:3000/;
}
include letsencrypt.conf;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question