سلام
من خواستم با داکر و با استفاده از certbot یک certificate برای دامنه های مورد نیازم درست بکنم ولی با خطای 404 مواجه میشم
کانفیگ nginx به این صورت هست البته اسم دامنه من example نیست فقط جهت ارائه نمونه اونو نوشتم
worker_processes auto;
pid /var/run/nginx.pid;
worker_rlimit_nofile 51200;
events {
use epoll;
worker_connections 51200;
multi_accept on;
accept_mutex_delay 100ms;
}
http {
server {
listen 80;
listen [::]:80;
server_name example.shop *.example.shop;
location / {
rewrite ^ https://$host$request_uri? permanent;
}
location /.well-known/ {
root /var/www/letsencrypt;
}
}
}
فایل داکر کمپوز
version: "3"
services:
nginx:
image: mojtabanaserei/nginx:1.15.5
container_name: nginx
restart: always
ports:
- 80:80
- 443:443
volumes:
- ./conf/nginx.conf:/etc/nginx/nginx.conf
- ./letsencrypt:/etc/letsencrypt
- ./letsencrypt-data:/var/www/letsencrypt
بعد دستور
sudo docker-compose up -d
بعد از دستور زیر استفاده میکنم
sudo docker run -it --rm \
-v ./letsencrypt:/etc/letsencrypt \
-v ./letsencrypt-data:/data/letsencrypt \
certbot/certbot certonly --webroot --webroot-path=/data/letsencrypt \
-d example.shop
خروجی دستور بالا
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for example.shop
Using the webroot path /data/letsencrypt for all unmatched domains.
Waiting for verification...
Cleaning up challenges
Failed authorization procedure. example.shop (http-01): urn:ietf:params:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://example.shop/.well-known/acme-challenge/W730hFL3BvIYWytnilxjeCjXp5YhR6tf9quo9bZzdP8: "<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.15.5</ce"
IMPORTANT NOTES:
- The following errors were reported by the server:
Domain: example.shop
Type: unauthorized
Detail: Invalid response from
http://example.shop/.well-known/acme-challenge/W630hFL3BvIdWytnilxjeCjXp5YhR6ts9quo9bZz4P8:
"<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.15.5</ce"
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.
- Your account credentials have been saved in your Certbot
configuration directory at /etc/letsencrypt. You should make a
secure backup of this folder now. This configuration directory will
also contain certificates and private keys obtained by Certbot so
making regular backups of this folder is ideal.
فایل ها و دایرکتوری های زیر هم در مسیر
/certbot/letsencrypt/
به صورت زیر ایجاد میشه