Welcome! Log In Create A New Profile

Advanced

Re: location root not working as described

Francis Daly
March 19, 2021 07:18PM
On Fri, Mar 19, 2021 at 03:01:19PM -0700, John Fowler wrote:

Hi there,

> I have nginx running in a docker container and configured to use let’s encrypt for certificates services.
> The location redirect to /var/www/certbot from /.well-known/acme-challenge does not seem to work.

Compare http://nginx.org/r/root and http://nginx.org/r/alias

You probably want alias.

> root@b15f5f234fbb:/var/log/nginx# cd /var/www/certbot
> root@b15f5f234fbb:/var/www/certbot# ls -l
> total 12
> -rw-r--r-- 1 root root 1727 Mar 18 03:22 index.html
> -rw-r--r-- 1 root root 1531 Mar 18 03:23 test.html
> -rw-r--r-- 1 root root 1533 Mar 9 02:59 test2.html
> root@b15f5f234fbb:/var/www/certbot#

> 2021/03/19 21:28:27 [error] 15#15: *1 open() "/var/www/certbot/.well-known/acme-challenge/index.html" failed (2: No such file or directory), client: 10.0.0.2, server: cyva.lese-fowler.us, request: "GET /.well-known/acme-challenge/index.html HTTP/1.1", host: "cyva.lese-fowler.us"

That GET request trying to open that file, is because "root" was used.

> # location ^~ /.well-known/acme-challenge {
> # location ^~ /.well-known/ {
> # allow all;
> # }
> # alias vs root
> location /.well-known/acme-challenge/ {
> allow all;
> root /var/www/certbot;
> try_files $uri =405;
> }

Probably use "location ^~", but definitely use "alias /var/www/certbot/;".

Cheers,

f
--
Francis Daly francis@daoine.org
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

location root not working as described

John Fowler March 19, 2021 06:02PM

Re: location root not working as described

Francis Daly March 19, 2021 07:18PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 55
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready