我有以下方式簡單泊塢窗容器運行在Nginx的:letsencrypt根目錄提供了404位於泊塢窗
docker service create --name nginx_proxy \
--mount type=bind,source=/opt/nginx/conf.d,target=/etc/nginx/conf.d \
--mount type=bind,source=/opt/nginx/webroot,target=/var/webroot \
--constraint 'node.role==manager' \
--publish 80:80 --publish 443:443 \
--network nginx-net \
nginx
創建的服務沒有問題運行。我補充說,通過代理在同一網絡(example.com.conf)其他服務的示例配置:(WWW)
server {
listen 80;
server_name example.com www.example.com;
location /.well-known/acme-challenge {
alias /var/webroot;
}
location/{
proxy_pass http://example_site:8080;
}
}
當我去example.com,我可以看到我的網站。由於我將host:/ opt/nginx/webroot裝載到容器:/ var/webroot,我在/ opt/nginx/webroot中創建了一個名爲「test.html」的文件(文件內容無關緊要)。
當我打開我的瀏覽器,鍵入:
http://example.com/.well-known/acme-challenge/test.html
我可以查看我添加到/ opt/nginx的/ Webroot公司的文件。但是,當我運行以下命令時certbot會拋出404:
certbot certonly --dry-run --webroot -w /opt/nginx/webroot -d example.com -d www.example.com
我在這裏丟失了什麼?據我瞭解,certbot在webroot目錄下創建一個文件並嘗試公開下載文件;但是,由於某種原因它沒有看到我的文件。
您可以發佈certbot和Nginx的日誌? – Moema