I have a small Linux VPS instance set up with nginx to proxy requests as a load balancer to multiple application servers.
All traffic is coming into https://app.example.com proxied to those upstream servers. Example nginx configuration for the load balancer:
upstream app_servers {
server app-1.example.com;
server app-2.example.com;
}
server {
listen 80;
listen 443 ssl;
include snippets/ssl-app.example.com.conf;
include snippets/ssl-params.conf;
server_name app.example.com;
root /var/www/html;
location / {
# Set proxy headers
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;
proxy_pass http://app_servers;
}
location ~ /.well-known {
allow all;
}
}
I set up letsencrypt and got certificate for app.example.com before setting up proxy and now I'm having trouble figure out how to configure nginx to proxy everything to the upstream app_servers except for anything to /.well-known so certbot can locally renew the SSL certificates on the server running this nginx load balancer. Any suggestions on how to route app.example.com/.well-known/ to a local path that letsencrypt certbot can use and hit successfully during renewal?
Update ensuring .well-known existed at /var/www/html (Debian) and setting root in conf allowed the certbot to renew properly. nginx conf snippet updated to reflect that.