5

My nginx config is

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;
    }
}

But when I run "/opt/certbot-auto certonly --webroot -w /usr/share/nginx/www/ -d op.liu666jiu.me" I got an error,it said that

Failed authorization procedure. op.liu666jiu.me (http-01): urn:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://op.liu666jiu.me/.well-known/acme-challenge/jwqzhx8QXCGjJQeyIBc_UfqXfO18wxjC896Zb5pTe7Y: "

and it said the file http://op.liu666jiu.me/.well-known/acme-challenge/jwqzhx8QXCGjJQeyIBc_UfqXfO18wxjC896Zb5pTe7Y 404 Not Found

it create the .well-known directory and I also try

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

Also it doesn't work, would you tell me why, Thanks!

0 Answers0