NGINX: Bypassing web application redirect for Certbot validation

Some web applications require a redirect for 404 pages. This will stand in the way of Certbot validating the certificate when the time comes for a renewal.

Here’s a quick snippet to bypass the redirect for the web application:

1
2
3
location /.well-known/acme-challenge/ {
    alias /var/www/php/.well-known/acme-challenge/;
}

This will allow for Certbot to validate the certificate and avoid being redirected.

Leave a Reply