# How-to: Nginx configuration to enable ACME Challenge support on all HTTP virtual hosts

**URL:** <https://community.letsencrypt.org/t/how-to-nginx-configuration-to-enable-acme-challenge-support-on-all-http-virtual-hosts/5622>\
**Category:** Server\
**Created:** [December 4, 2015, 8:02pm UTC](https://community.letsencrypt.org/t/how-to-nginx-configuration-to-enable-acme-challenge-support-on-all-http-virtual-hosts/5622 "2015-12-04T20:02:03Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![tomwald](https://avatars.discourse-cdn.com/v4/letter/t/8491ac/32.png) [@tomwald](https://community.letsencrypt.org/u/tomwald)\
**Post date:** [November 30, 2016, 8:19pm UTC](https://community.letsencrypt.org/t/how-to-nginx-configuration-to-enable-acme-challenge-support-on-all-http-virtual-hosts/5622/3 "2016-11-30T20:19:17Z")

</div>

I know this is an old thread, but since Google finds it for many searches I thought I'd post my recent experience.

I found the configuration above didn't work for me, using the [acmetool](https://github.com/hlandau/acme) client and nginx. The primary problem was Acme was writing the challenge file to

`/var/www/acme-challenge/`

whereas Nginx was looking in this directory

`/var/www/acme-challenge/.well-known/acme-challenge/`

The combination of the acmetool logs and the Nginx logs made this obvious. Here are the two commands that helped parse the acmetool logs, from MrTen on [this github page](https://github.com/hlandau/acme/issues/227#issuecomment-263822008)

```
acmetool --xlog.severity=debug > /tmp/dump 2>&1 
fgrep -v fdb: /tmp/dump | fgrep -v storageops: | less

```

The reason was found on Server Fault, on [this question](http://stackoverflow.com/questions/10631933/nginx-static-file-serving-confusion-with-root-alias):

> In case of the root directive, full path is appended to the root including the location part, whereas in case of the alias directive, only the portion of the path NOT including the location part is appended to the alias.

The nginx location block that worked for me is as below

```
location ^~ /.well-known/acme-challenge/ {
  alias /var/www/acme-challenge/;
}

```

---

_[View the full topic](https://community.letsencrypt.org/t/how-to-nginx-configuration-to-enable-acme-challenge-support-on-all-http-virtual-hosts/5622)._
