# Certbot run error with unauthorized

**URL:** <https://community.letsencrypt.org/t/certbot-run-error-with-unauthorized/169571>\
**Category:** Help\
**Created:** [January 12, 2022, 2:24pm UTC](https://community.letsencrypt.org/t/certbot-run-error-with-unauthorized/169571 "2022-01-12T14:24:52Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![storehubdeploy](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/storehubdeploy/32/57382_2.png) [@storehubdeploy](https://community.letsencrypt.org/u/storehubdeploy)\
**Post date:** [January 12, 2022, 2:24pm UTC](https://community.letsencrypt.org/t/certbot-run-error-with-unauthorized/169571/1 "2022-01-12T14:24:52Z")

</div>

Please fill out the fields below so we can help you better. Note: you must provide your domain name to get help. Domain names for issued certificates are all made public in Certificate Transparency logs (e.g. [crt.sh | example.com](https://crt.sh/?q=example.com)), so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.

My domain is:  
`www.inorithailand.com`  
I ran this command:  
certbot --nginx --hsts --redirect -n -m [chunhong@storehub.com](mailto:chunhong@storehub.com) --agree-tos -d [www.inorithailand.com](http://www.inorithailand.com)  
It produced this output:  
022-01-12 22:03:22,226:DEBUG:urllib3.connectionpool:[https://acme-v02.api.letsencrypt.org:443](https://acme-v02.api.letsencrypt.org:443) "POST /acme/authz-v3/67520390950 HTTP/1.1" 200 1267  
2022-01-12 22:03:22,227:DEBUG:acme.client:Received response:  
HTTP 200  
Server: nginx  
Date: Wed, 12 Jan 2022 14:03:22 GMT  
Content-Type: application/json  
Content-Length: 1267  
Connection: keep-alive  
Boulder-Requester: 37675879  
Cache-Control: public, max-age=0, no-cache  
Link: [https://acme-v02.api.letsencrypt.org/directory](https://acme-v02.api.letsencrypt.org/directory);rel="index"  
Replay-Nonce: 0101C4rvqgMhuH5agx7HYaONN6OC7fzGOIe1GGY1y592jdY  
X-Frame-Options: DENY  
Strict-Transport-Security: max-age=604800

{  
"identifier": {  
"type": "dns",  
"value": "[www.inorithailand.com](http://www.inorithailand.com)"  
},  
"status": "invalid",  
"expires": "2022-01-19T14:03:14Z",  
"challenges": [  
{  
"type": "http-01",  
"status": "invalid",  
"error": {  
"type": "urn:ietf:params:acme:error:unauthorized",  
"detail": "Invalid response from [http://www.inorithailand.com/.well-known/acme-challenge/MLpJ60SbV1kORzkNwvirotPwRbamzZfpA1dtGmzm\_x8](http://www.inorithailand.com/.well-known/acme-challenge/MLpJ60SbV1kORzkNwvirotPwRbamzZfpA1dtGmzm_x8) [18.136.18.246]: "\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n\n\u003chead\u003e\n\t\u003cmeta http-equiv=\"content-type\" content=\"text/html;charset=UTF-8\" /\u003e\n\t\u003cmeta charset=\"utf-8\" /\u003e\n\t"",  
"status": 403  
},  
"url": "[https://acme-v02.api.letsencrypt.org/acme/chall-v3/67520390950/yvaBaA](https://acme-v02.api.letsencrypt.org/acme/chall-v3/67520390950/yvaBaA)",  
"token": "MLpJ60SbV1kORzkNwvirotPwRbamzZfpA1dtGmzm\_x8",  
"validationRecord": [  
{  
"url": "[http://www.inorithailand.com/.well-known/acme-challenge/MLpJ60SbV1kORzkNwvirotPwRbamzZfpA1dtGmzm\_x8](http://www.inorithailand.com/.well-known/acme-challenge/MLpJ60SbV1kORzkNwvirotPwRbamzZfpA1dtGmzm_x8)",  
"hostname": "[www.inorithailand.com](http://www.inorithailand.com)",  
"port": "80",  
"addressesResolved": [  
"18.136.18.246"  
],  
"addressUsed": "18.136.18.246"  
}  
],  
"validated": "2022-01-12T14:03:20Z"  
}  
]  
}  
My web server is (include version):  
nginx/1.10.3  
The operating system my web server runs on is (include version):  
Ubuntu 16.04.5 LTS  
My hosting provider, if applicable, is:

I can login to a root shell on my machine (yes or no, or I don't know):  
yes  
I'm using a control panel to manage my site (no, or provide the name and version of the control panel):  
no  
The version of my client is (e.g. output of `certbot --version` or `certbot-auto --version` if you're using Certbot):  
certbot 0.39.0

---

<div class="post-metadata">

**Author:** ![rg305](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/rg305/32/91314_2.png) [@rg305](https://community.letsencrypt.org/u/rg305)\
**Post date:** [January 12, 2022, 8:26pm UTC](https://community.letsencrypt.org/t/certbot-run-error-with-unauthorized/169571/2 "2022-01-12T20:26:59Z")

</div>

Hi @storehubdeploy and welcome to the LE community forum 🙂

It seems like the `certbot --nginx` plugin is unable to properly place the challenge file.  
Let's have a look at that complete config, with:  
`nginx -T`

---

<div class="post-metadata">

**Author:** ![storehubdeploy](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/storehubdeploy/32/57382_2.png) [@storehubdeploy](https://community.letsencrypt.org/u/storehubdeploy)\
**Post date:** [January 13, 2022, 7:48am UTC](https://community.letsencrypt.org/t/certbot-run-error-with-unauthorized/169571/4 "2022-01-13T07:48:24Z")

</div>

Sorry the config is too large. we set more than 700 customs domain in the nginx server, this is my specific domain config

```nohighlight
server {  
        listen 80;
        listen [::]:80;
        resolver 8.8.8.8;

        # Add index.php to the list if you are using PHP
        # index index.html index.htm index.nginx-debian.html;

        server_name www.inorithailand.com;

        location / {
                proxy_set_header Host inori.storehub.me;
                proxy_set_header X-Forwarded-Proto "https";
                proxy_set_header X-Forwarded-Host $host;
                proxy_pass http://ecommerce-pro$request_uri;
        }
}

```

---

<div class="post-metadata">

**Author:** ![MikeMcQ](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/mikemcq/32/52772_2.png) [@MikeMcQ](https://community.letsencrypt.org/u/MikeMcQ)\
**Post date:** [January 13, 2022, 1:29pm UTC](https://community.letsencrypt.org/t/certbot-run-error-with-unauthorized/169571/5 "2022-01-13T13:29:45Z")

</div>

When nginx conf have a large number of server blocks you may need to add this to your certbot command:

```nohighlight
  --nginx-sleep-seconds NGINX_SLEEP_SECONDS
                        Number of seconds to wait for nginx configuration
                        changes to apply when reloading. (default: 1)

```

Maybe try 10 seconds as the default is just 1

---

<div class="post-metadata">

**Author:** ![storehubdeploy](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/storehubdeploy/32/57382_2.png) [@storehubdeploy](https://community.letsencrypt.org/u/storehubdeploy)\
**Post date:** [January 14, 2022, 4:51am UTC](https://community.letsencrypt.org/t/certbot-run-error-with-unauthorized/169571/6 "2022-01-14T04:51:27Z")

</div>

i try with the command i got this info

ginx: [warn] conflicting server name "[www.inorithailand.com](http://www.inorithailand.com)" on 0.0.0.0:80, ignored  
nginx: [warn] conflicting server name "[www.inorithailand.com](http://www.inorithailand.com)" on [::]:80, ignored  
Waiting for verification...  
Challenge failed for domain [www.inorithailand.com](http://www.inorithailand.com)  
http-01 challenge for [www.inorithailand.com](http://www.inorithailand.com)  
Cleaning up challenges  
nginx: [warn] conflicting server name "[www.inorithailand.com](http://www.inorithailand.com)" on 0.0.0.0:80, ignored  
nginx: [warn] conflicting server name "[www.inorithailand.com](http://www.inorithailand.com)" on [::]:80, ignored  
Some challenges have failed.

IMPORTANT NOTES:

- The following errors were reported by the server:

---

<div class="post-metadata">

**Author:** ![MikeMcQ](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/mikemcq/32/52772_2.png) [@MikeMcQ](https://community.letsencrypt.org/u/MikeMcQ)\
**Post date:** [January 14, 2022, 3:45pm UTC](https://community.letsencrypt.org/t/certbot-run-error-with-unauthorized/169571/7 "2022-01-14T15:45:47Z")

</div>

> [@storehubdeploy](#):
>
> ginx: [warn] conflicting server name "[www.inorithailand.com](http://www.inorithailand.com)" on 0.0.0.0:80, ignored  
> nginx: [warn] conflicting server name "[www.inorithailand.com](http://www.inorithailand.com)" on [::]:80, ignored

This says you have two server blocks for the same name. That is wrong and might cause certbot to update the wrong one. You need to remove the duplicate and confirm fixed using:

```nohighlight
nginx -t

```

If that is ok then try certbot with the sleep seconds again.

---

<div class="post-metadata">

**Author:** ![storehubdeploy](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/storehubdeploy/32/57382_2.png) [@storehubdeploy](https://community.letsencrypt.org/u/storehubdeploy)\
**Post date:** [January 17, 2022, 3:25am UTC](https://community.letsencrypt.org/t/certbot-run-error-with-unauthorized/169571/8 "2022-01-17T03:25:41Z")

</div>

i'm sure the config is ok! this is the dns record i find

 ![image](https://global.discourse-cdn.com/letsencrypt/original/3X/5/9/593ef300875befced8e1d2e6f4592998a9370ece.jpeg)  
is affected by domain without www?

---

<div class="post-metadata">

**Author:** ![rg305](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/rg305/32/91314_2.png) [@rg305](https://community.letsencrypt.org/u/rg305)\
**Post date:** [January 17, 2022, 3:35am UTC](https://community.letsencrypt.org/t/certbot-run-error-with-unauthorized/169571/9 "2022-01-17T03:35:41Z")

</div>

I think you might do well by adding handling for the challenge request within the HTTP vhost config file.

Like:

```nohighlight
        location /.well-known/acme-challenge/ {
            try_files $uri 404;
            root /unique-ACMEchallenge-folder/; # this folder needs to be created
        }#location

```

---

<div class="post-metadata">

**Author:** ![storehubdeploy](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/storehubdeploy/32/57382_2.png) [@storehubdeploy](https://community.letsencrypt.org/u/storehubdeploy)\
**Post date:** [January 17, 2022, 4:48am UTC](https://community.letsencrypt.org/t/certbot-run-error-with-unauthorized/169571/10 "2022-01-17T04:48:21Z")

</div>

still get error

IMPORTANT NOTES:

- The following errors were reported by the server:

---

<div class="post-metadata">

**Author:** ![Osiris](https://avatars.discourse-cdn.com/v4/letter/o/839c29/32.png) [@Osiris](https://community.letsencrypt.org/u/Osiris)\
**Post date:** [January 17, 2022, 5:53am UTC](https://community.letsencrypt.org/t/certbot-run-error-with-unauthorized/169571/11 "2022-01-17T05:53:56Z")

</div>

@rg305 you probably intended to use your recommendation in combination with the `webroot` plugin, right?

---

<div class="post-metadata">

**Author:** ![rg305](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/rg305/32/91314_2.png) [@rg305](https://community.letsencrypt.org/u/rg305)\
**Post date:** [January 17, 2022, 8:26pm UTC](https://community.letsencrypt.org/t/certbot-run-error-with-unauthorized/169571/12 "2022-01-17T20:26:53Z")

</div>

Using `--webroot` would increase the chance of success, but it shouldn't be required.  
It just looks like the HTTP vhost has nowhere to handle the challenge requests.

---

<div class="post-metadata">

**Author:** ![Osiris](https://avatars.discourse-cdn.com/v4/letter/o/839c29/32.png) [@Osiris](https://community.letsencrypt.org/u/Osiris)\
**Post date:** [January 17, 2022, 8:30pm UTC](https://community.letsencrypt.org/t/certbot-run-error-with-unauthorized/169571/13 "2022-01-17T20:30:02Z")

</div>

> [@rg305](#):
>
> Using `--webroot` would increase the chance of success, but it shouldn't be required.

But the `--nginx` configuration adds its own challenge handeling nginx configuration piece, right? Doesn't that "bite" with your suggested part?

---

<div class="post-metadata">

**Author:** ![rg305](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/rg305/32/91314_2.png) [@rg305](https://community.letsencrypt.org/u/rg305)\
**Post date:** [January 17, 2022, 8:32pm UTC](https://community.letsencrypt.org/t/certbot-run-error-with-unauthorized/169571/14 "2022-01-17T20:32:31Z")

</div>

Possibly:

> [@storehubdeploy](#):
>
> certbot 0.39.0

[that could use some _attention_]

We've yet to see the entire `nginx` config...  
And this is usually _difficult_ to deal with:

> [@storehubdeploy](#):
>
> ```nohighlight
> location / {
> proxy_set_header Host inori.storehub.me;
> proxy_set_header X-Forwarded-Proto "https";
> proxy_set_header X-Forwarded-Host $host;
> proxy_pass http://ecommerce-pro$request_uri;
> }
> 
> ```

---

<div class="post-metadata">

**Author:** ![Osiris](https://avatars.discourse-cdn.com/v4/letter/o/839c29/32.png) [@Osiris](https://community.letsencrypt.org/u/Osiris)\
**Post date:** [January 17, 2022, 8:33pm UTC](https://community.letsencrypt.org/t/certbot-run-error-with-unauthorized/169571/15 "2022-01-17T20:33:54Z")

</div>

> [@rg305](#):
>
> And this is usually _difficult_ to deal with:
> 
> > [@storehubdeploy](#):
> >
> > ````nohighlight
> > > 
> > > ```
> > 
> > ````

Your suggested `location` section should fix that. But I would use it with the webroot authenticator and not with the nginx authenticator, just to be sure.

---

<div class="post-metadata">

**Author:** ![rg305](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/rg305/32/91314_2.png) [@rg305](https://community.letsencrypt.org/u/rg305)\
**Post date:** [January 17, 2022, 8:34pm UTC](https://community.letsencrypt.org/t/certbot-run-error-with-unauthorized/169571/16 "2022-01-17T20:34:45Z")

</div>

I would like to see it fail (if it does) before using `--webroot`, so that they might look further into the other 700 vhosts for the overlap/problem.

---

<div class="post-metadata">

**Author:** ![storehubdeploy](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/storehubdeploy/32/57382_2.png) [@storehubdeploy](https://community.letsencrypt.org/u/storehubdeploy)\
**Post date:** [January 18, 2022, 3:29am UTC](https://community.letsencrypt.org/t/certbot-run-error-with-unauthorized/169571/17 "2022-01-18T03:29:52Z")

</div>

the all conifg

```nohighlight
user www-data;
worker_processes auto;
pid /run/nginx.pid;

events {
        worker_connections 768;
        # multi_accept on;
    }

http {
        # Basic Settings
        server_names_hash_bucket_size 512;
        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 65;

        types_hash_max_size 2048;
        server_tokens off;

        # server_names_hash_bucket_size 64;
        # server_name_in_redirect off;

        include /etc/nginx/mime.types;
        default_type application/octet-stream;

        # SSL Settings

        ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
        ssl_prefer_server_ciphers on;

        # Logging Settings

        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;

        # Gzip Settings

        gzip on;
        gzip_disable "msie6";

        gzip_vary on;
        gzip_proxied any;
        gzip_comp_level 6;
        gzip_buffers 16 8k;
        gzip_http_version 1.1;
        gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

    upstream ecommerce-uat{
        server 192.168.0.206:28910;
        server 192.168.0.17:28910;
    }

    upstream ecommerce-pro{
        server 192.168.0.86:28910;
        server 192.168.0.17:28910;
    }
        # Virtual Host Configs
        server {
        server_name storehub.me;
        server_name ~^(.*)\.storehub.me;
        resolver 8.8.8.8;
        
        if ($host = "gossipbarnkitchen.storehub.me"){
            return 404;
        }
        if ($host = "suriaaminudinenterprise.storehub.me"){
            return 404;
        }
        if ($host = "pearltitaniumenterprise.storehub.me"){
            return 404;
        }
        location /
        {
            include proxy_params;
            proxy_pass http://ecommerce-pro$request_uri;
        }

        listen [::]:443 ssl ipv6only=on;
        listen 443 ssl;
        ssl_certificate /etc/letsencrypt/live/storehub.me/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/storehub.me/privkey.pem;
        include /etc/letsencrypt/options-ssl-nginx.conf;
        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

        proxy_buffer_size 128k;
        proxy_buffers 32 32k;
        proxy_busy_buffers_size 128k;
    }

    server {

        listen 80;

        server_name ~^(?<name>.+)\.storehub\.me$;
        return 301 https://$name.storehub.me$request_uri;
    }
    server {  
        listen 80;
        listen [::]:80;
        resolver 8.8.8.8;

        # Add index.php to the list if you are using PHP
        # index index.html index.htm index.nginx-debian.html;

        server_name www.inorithailand.com;

        location / {
                proxy_set_header Host inori.storehub.me;
                proxy_set_header X-Forwarded-Proto "https";
                proxy_set_header X-Forwarded-Host $host;
                proxy_pass http://ecommerce-pro$request_uri;
        }
    }

}

```

---

<div class="post-metadata">

**Author:** ![MikeMcQ](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/mikemcq/32/52772_2.png) [@MikeMcQ](https://community.letsencrypt.org/u/MikeMcQ)\
**Post date:** [January 18, 2022, 3:50am UTC](https://community.letsencrypt.org/t/certbot-run-error-with-unauthorized/169571/18 "2022-01-18T03:50:14Z")

</div>

I have not studied the regex `server_name` syntax but could this problem be related to this? Sorry don't have much time tonite but at least found this much.

> <https://github.com/certbot/certbot/issues/4930#issuecomment-316224973>
>
> \## My operating system is (include version):
> Ubuntu 14.04.5 LTS
> Certbot 0.14.2…
> 
> \## I installed Certbot with (certbot-auto, OS package manager, pip, etc):
> OS package manager from PPA certbot/certbot
> 
> \## I ran this command and it produced this output:
> \`\`\` bash
> certbot renew
> \`\`\`
> 
> \`\`\`bash
> \-------------------------------------------------------------------------------
> Processing /etc/letsencrypt/renewal/proof.ace.bigroominternet.co.uk.conf
> \-------------------------------------------------------------------------------
> Cert is due for renewal, auto-renewing...
> Renewing an existing certificate
> Performing the following challenges:
> tls-sni-01 challenge for proof.ace.bigroominternet.co.uk
> tls-sni-01 challenge for 1.ace.bigroominternet.co.uk
> tls-sni-01 challenge for 2.ace.bigroominternet.co.uk
> tls-sni-01 challenge for 3.ace.bigroominternet.co.uk
> tls-sni-01 challenge for 4.ace.bigroominternet.co.uk
> tls-sni-01 challenge for 5.ace.bigroominternet.co.uk
> tls-sni-01 challenge for 6.ace.bigroominternet.co.uk
> tls-sni-01 challenge for 7.ace.bigroominternet.co.uk
> tls-sni-01 challenge for 8.ace.bigroominternet.co.uk
> tls-sni-01 challenge for 9.ace.bigroominternet.co.uk
> Cleaning up challenges
> Attempting to renew cert from /etc/letsencrypt/renewal/proof.ace.bigroominternet.co.uk.conf produced an unexpected error: Cannot find a VirtualHost matching domain 1.ace.bigroominternet.co.uk.. Skipping.
> \`\`\`
> 
> \## Certbot's behavior differed from what I expected because:
> It should have matched and renewed. As you can see I use a regular expression for my virtual host servername.
> 
> \## Here is a Certbot log showing the issue (if available):
> \`\`\`
> 2017-07-14 09:31:27,549:DEBUG:acme.client:Storing nonce: F90VgH0lY-qBYJht5yp6okoZoH9bVA3GRuKmBzrc6Yo
> 2017-07-14 09:31:27,550:INFO:certbot.auth\_handler:Performing the following challenges:
> 2017-07-14 09:31:27,550:INFO:certbot.auth\_handler:tls-sni-01 challenge for proof.ace.bigroominternet.co.uk
> 2017-07-14 09:31:27,551:INFO:certbot.auth\_handler:tls-sni-01 challenge for 1.ace.bigroominternet.co.uk
> 2017-07-14 09:31:27,551:INFO:certbot.auth\_handler:tls-sni-01 challenge for 2.ace.bigroominternet.co.uk
> 2017-07-14 09:31:27,552:INFO:certbot.auth\_handler:tls-sni-01 challenge for 3.ace.bigroominternet.co.uk
> 2017-07-14 09:31:27,553:INFO:certbot.auth\_handler:tls-sni-01 challenge for 4.ace.bigroominternet.co.uk
> 2017-07-14 09:31:27,553:INFO:certbot.auth\_handler:tls-sni-01 challenge for 5.ace.bigroominternet.co.uk
> 2017-07-14 09:31:27,553:INFO:certbot.auth\_handler:tls-sni-01 challenge for 6.ace.bigroominternet.co.uk
> 2017-07-14 09:31:27,553:INFO:certbot.auth\_handler:tls-sni-01 challenge for 7.ace.bigroominternet.co.uk
> 2017-07-14 09:31:27,553:INFO:certbot.auth\_handler:tls-sni-01 challenge for 8.ace.bigroominternet.co.uk
> 2017-07-14 09:31:27,553:INFO:certbot.auth\_handler:tls-sni-01 challenge for 9.ace.bigroominternet.co.uk
> 2017-07-14 09:31:27,835:DEBUG:certbot.error\_handler:Encountered exception:
> Traceback (most recent call last):
> File "/usr/lib/python2.7/dist-packages/certbot/auth\_handler.py", line 115, in \_solve\_challenges
> resp = self.auth.perform(self.achalls)
> File "/usr/lib/python2.7/dist-packages/certbot\_nginx/configurator.py", line 805, in perform
> sni\_response = chall\_doer.perform()
> File "/usr/lib/python2.7/dist-packages/certbot\_nginx/tls\_sni\_01.py", line 55, in perform
> vhost = self.configurator.choose\_vhost(achall.domain)
> File "/usr/lib/python2.7/dist-packages/certbot\_nginx/configurator.py", line 243, in choose\_vhost
> "Cannot find a VirtualHost matching domain %s." % (target\_name))
> MisconfigurationError: Cannot find a VirtualHost matching domain 1.ace.bigroominternet.co.uk.
> 
> 2017-07-14 09:31:27,835:DEBUG:certbot.error\_handler:Calling registered functions
> 2017-07-14 09:31:27,835:INFO:certbot.auth\_handler:Cleaning up challenges
> 2017-07-14 09:31:28,358:DEBUG:certbot\_nginx.parser:Could not parse file: /etc/nginx/sites-enabled/default due to Expected "#" (at char 0), (line:1, col:1)
> 2017-07-14 09:31:29,742:WARNING:certbot.renewal:Attempting to renew cert from /etc/letsencrypt/renewal/proof.ace.bigroominternet.co.uk.conf produced an unexpected error: Cannot find a VirtualHost matching domain 1.ace.bigroominternet.co.uk.. Skipping.
> 2017-07-14 09:31:29,743:DEBUG:certbot.renewal:Traceback was:
> Traceback (most recent call last):
> File "/usr/lib/python2.7/dist-packages/certbot/renewal.py", line 418, in handle\_renewal\_request
> main.renew\_cert(lineage\_config, plugins, renewal\_candidate)
> File "/usr/lib/python2.7/dist-packages/certbot/main.py", line 640, in renew\_cert
> \_get\_and\_save\_cert(le\_client, config, lineage=lineage)
> File "/usr/lib/python2.7/dist-packages/certbot/main.py", line 77, in \_get\_and\_save\_cert
> renewal.renew\_cert(config, domains, le\_client, lineage)
> File "/usr/lib/python2.7/dist-packages/certbot/renewal.py", line 296, in renew\_cert
> new\_certr, new\_chain, new\_key, \_ = le\_client.obtain\_certificate(domains)
> File "/usr/lib/python2.7/dist-packages/certbot/client.py", line 313, in obtain\_certificate
> self.config.allow\_subset\_of\_names)
> File "/usr/lib/python2.7/dist-packages/certbot/auth\_handler.py", line 74, in get\_authorizations
> resp = self.\_solve\_challenges()
> File "/usr/lib/python2.7/dist-packages/certbot/auth\_handler.py", line 115, in \_solve\_challenges
> resp = self.auth.perform(self.achalls)
> File "/usr/lib/python2.7/dist-packages/certbot\_nginx/configurator.py", line 805, in perform
> sni\_response = chall\_doer.perform()
> File "/usr/lib/python2.7/dist-packages/certbot\_nginx/tls\_sni\_01.py", line 55, in perform
> vhost = self.configurator.choose\_vhost(achall.domain)
> File "/usr/lib/python2.7/dist-packages/certbot\_nginx/configurator.py", line 243, in choose\_vhost
> "Cannot find a VirtualHost matching domain %s." % (target\_name))
> MisconfigurationError: Cannot find a VirtualHost matching domain 1.ace.bigroominternet.co.uk.
> \`\`\`
> 
> \## Here is the relevant nginx server block or Apache virtualhost for the domain I am configuring:
> \`\`\`
> server {
> server\_name ~^(?\<sname\>.+?).ace.bigroominternet.co.uk$;
> 
> root /var/www/acemedia/$sname/public;
> 
> error\_log ../error.log;
> 
> error\_page 500 501 502 503 504 $document\_root/whoops.html;
> 
> charset UTF-8;
> 
> index index.php index.html;
> client\_max\_body\_size 60m;
> 
> location / {
> try\_files $uri $uri/ /index.php$is\_args$args;
> }
> 
> location ~ /\\.well-known\\/acme-challenge {
> allow all;
> }
> 
> location = /robots.txt { access\_log off; log\_not\_found off; }
> location = /humans.txt { access\_log off; log\_not\_found off; }
> location = /favicon.ico { access\_log off; log\_not\_found off; }
> 
> location ~ \\.php$ {
> try\_files $uri =404;
> 
> fastcgi\_pass unix:/var/run/php/php5.6-fpm.sock;
> fastcgi\_index index.php;
> 
> include fastcgi\_params;
> fastcgi\_read\_timeout 1800s;
> }
> 
> location ~ /\\. {
> access\_log off;
> log\_not\_found off;
> deny all;
> }
> 
> listen 443 ssl; # managed by Certbot
> ssl\_certificate /etc/letsencrypt/live/proof.ace.bigroominternet.co.uk/fullchain.pem; # managed by Certbot
> ssl\_certificate\_key /etc/letsencrypt/live/proof.ace.bigroominternet.co.uk/privkey.pem; # managed by Certbot
> include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
> }
> \`\`\`

---

<div class="post-metadata">

**Author:** ![rg305](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/rg305/32/91314_2.png) [@rg305](https://community.letsencrypt.org/u/rg305)\
**Post date:** [January 18, 2022, 5:13am UTC](https://community.letsencrypt.org/t/certbot-run-error-with-unauthorized/169571/19 "2022-01-18T05:13:42Z")

</div>

> [@rg305](#):
>
> ```nohighlight
> location /.well-known/acme-challenge/ {
> try_files $uri 404;
> root /unique-ACMEchallenge-folder/; # this folder needs to be created
> }#location
> 
> ```

If you created the directory with the HTTP vhost for `www.inorithailand.com`, you can now test it with:

```nohighlight
echo "test-file-full-path" > /unique-ACMEchallenge-folder/.well-known/acme-challenge/Test_File-1234
echo "test-file-short-path" > /unique-ACMEchallenge-folder/Test_File-1234

```

then browse to:  
`http://www.inorithailand.com/.well-known/acme-challenge/Test_file-1234`  
[hopefully something will be returned (other than a 404 error)]

---

<div class="post-metadata">

**Author:** ![storehubdeploy](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/storehubdeploy/32/57382_2.png) [@storehubdeploy](https://community.letsencrypt.org/u/storehubdeploy)\
**Post date:** [January 18, 2022, 6:52am UTC](https://community.letsencrypt.org/t/certbot-run-error-with-unauthorized/169571/20 "2022-01-18T06:52:33Z")

</div>

> [@rg305](#):
>
> [http://www.inorithailand.com/.well-known/acme-challenge/Test\_file-1234](http://www.inorithailand.com/.well-known/acme-challenge/Test_file-1234)

i set as you advise but reponse still is 404

---

<div class="post-metadata">

**Author:** ![storehubdeploy](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/storehubdeploy/32/57382_2.png) [@storehubdeploy](https://community.letsencrypt.org/u/storehubdeploy)\
**Post date:** [January 18, 2022, 10:37am UTC](https://community.letsencrypt.org/t/certbot-run-error-with-unauthorized/169571/21 "2022-01-18T10:37:17Z")

</div>

I'm sure not that syntax problem，because i add other domains is ok！this domain [www.inorithailand.com](http://www.inorithailand.com) i added successfully before with the same config，but not used for a while i deleted it, then i re-added the domain i got the error.

[Next page](https://community.letsencrypt.org/t/certbot-run-error-with-unauthorized/169571.md?page=2)
