1

When I ran this command in my digital ocean server:

sudo certbot --authenticator webroot --webroot-path /home/james/postr --installer nginx -d <sitename>

I get this error:

Failed authorization procedure

The client lacks sufficient authorization :: Invalid response from 
http://www.<sitename>.com/.well-known/acme-challenge/oAVGa4eBNfQQ1Vrn_q-
iKjV2T6ue3H5kOcxEWpztrHc

IMPORTANT NOTES:
 - The following errors were reported by the server:

   Domain: www.venvor.com
   Type:   unauthorized
   Detail: Invalid response from
   http://www.<sitename>.com/.well-known/acme-challenge/oAVGa4eBNfQQ1Vrn_q-
   iKjV2T6ue3H5kOcxEWpztrHc:
   "<h1>Not Found</h1><p>The requested URL
   /.well-known/acme-challenge/oAVGa4eBNfQQ1Vrn_q-iKjV2T6ue3H5kOcxEWpztrHc
   was not found on "

I already tried adding the url path to my urls file:

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^.well-known/acme-challenge/', admin.site.urls),
]

However it still doesn't work. Any idea what the problem is?

EDIT:

/etc/nginx/sites-available/postr

server {
    listen 80;
    server_name venvor.com www.venvor.com 174.138.62.249;
    location = /favicon.ico { access_log off; log_not_found off; }
    location /static/ {
        root /home/james/postr;
    }

    location / {
        include proxy_params;
        proxy_pass http://unix:/home/james/postr/draft1.sock;
    }
}
  • Have you configured location block in your nginx conf file to allow access to those ACME challenge files? – Rajesh Keladimath Jan 17 '18 at 9:51
  • No I haven't - could you tell me what exactly I add to my location block? I've added my current config file in my edit. – Zorgan Jan 17 '18 at 9:54
1

Please add the below location block to your nginx configuration file :

location ^~ /.well-known {
root /your_path_to/document_root;
allow all;
}

How it works :

  • The Let’s Encrypt verification server will look for verification files created by the client in a subdir of your docroot ( .well-known). This means that these files must be publicly accessible.

  • In the above location block "^~" modifier does the non-regular expression match. For instance, it could handle requests for /.well-known/acme-challenge/dkaslf_kfjadlkso^kfds-fkdssjl .

  • allow all directive grants the public access to the specified folder.

Please refer : https://letsencrypt.org/how-it-works.

  • Thankyou! This works the site(s) are now HTTPS. Can you please explain exactly how your code is working in the Nginx config file? Also I chose: 2: Redirect - Make all requests redirect to secure HTTPS access - can you tell me the implications of this? – Zorgan Jan 17 '18 at 20:51
  • I have edited my answer. Hope it helps. – Rajesh Keladimath Jan 18 '18 at 4:48
  • And on selecting Redirect option, all your insecure http requests will be redirected to secured requests now. – Rajesh Keladimath Jan 18 '18 at 4:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.