Nginx proxy_pass使certbot无法正常工作

时间:2017-02-16 13:30:57

标签: nginx certbot

我的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-已知目录,我也尝试

location /.well-known/acme-challenge/ {
    try_files $uri /dev/null =404;
}

它也不起作用,你能告诉我原因吗,谢谢!

0 个答案:

没有答案