我的 nginx 配置是
server {
listen [::]:80;
root /usr/share/nginx/www/;
index index.html index.htm;
server_name op.liu666jiu.me;
location / {
proxy_set_header HOST $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://opproxy.liu666jiu.me;
}
location ^~ /.well-known/acme-challenge/ {
default_type "text/plain";
root /usr/share/nginx/www/;
}
location /doc/ {
alias /usr/share/doc/;
autoindex on;
allow 127.0.0.1;
allow ::1;
deny all;
}
}
但是当我运行“/opt/certbot-auto certonly --webroot -w /usr/share/nginx/www/ -d op.liu666jiu.me”时出现错误,它说
授权程序失败。op.liu666jiu.me (http-01): urn:acme:error:unauthorized :: 客户端缺乏足够的授权 :: http://op.liu666jiu.me/.well-known/acme-challenge/jwqzhx8QXCGjJQeyIBc_UfqXfO18wxjC896Zb5pTe7Y的响应无效:“
它说文件http://op.liu666jiu.me/.well-known/acme-challenge/jwqzhx8QXCGjJQeyIBc_UfqXfO18wxjC896Zb5pTe7Y 404 Not Found
它创建 .well-known 目录,我也尝试
location /.well-known/acme-challenge/ {
try_files $uri /dev/null =404;
}
也不行,请问是什么原因,谢谢!