I have a working Nginx config that:
Performs a hard-redirect (301) from http to https
Additionally, ignores subpaths on http (http://www.example.com/ANY/THING redirects to plain https://example.com)
Serves an application from https
How can I modify the config file so that I can:
Generate the HTTPS certificate with certbot/Let's Encrypt
In 90 days, run
certbot renew
without having to edit the config
This example uses a static root instead of an application. Replace the
location /
block in the HTTPS section as appropriate...1) Create conf file (note that
ssl_certificate
lines are commented out)2) Run certbot
3) Update conf file. Uncomment ssl_certificate lines:
4) Restart nginx
5) Test renewal (with force-renewal, not dry-run)
6) In 90 days, renew as normal...