How-to guide · Automate renewal
How to get a Let's Encrypt certificate for an IP address
In one sentence
Issue a publicly trusted certificate for your server's IP address with Certbot, then automate renewal and verify the certificate the server actually serves.
- Task
- Automate renewal
- Platforms
- Linux
- nginx
- Level
- Practitioner · 5 steps
On this page
- Before you start
- Steps
- 1. Confirm the client and the validation route
- 2. Serve the challenge path on the IP’s HTTP virtual host
- 3. Rehearse against staging without saving a test certificate
- 4. Issue and install the production certificate
- 5. Save the reload hook and prove renewal
- Check it worked
- If something goes wrong
- Why this works
- Go deeper
Before you start
- A publicly routable IP address you control, with inbound HTTP on port 80 and HTTPS on port 443.
- A Linux server with NGINX and Certbot 5.4 or later for the webroot workflow below.
- Permission to configure the IP’s HTTP and HTTPS virtual hosts and run automatic renewal.
- A monitoring check independent of the issuing process.
Let’s Encrypt supports certificates for both IPv4 and IPv6. Its IP certificates require the shortlived profile, valid for 160 hours (just over six days). That makes working renewal and deployment part of the initial setup, not an optional later improvement.
The address 203.0.113.10 below is reserved for documentation and cannot be used to obtain a certificate. Replace it everywhere with your own public address. A private LAN address, localhost or a loopback IP needs a development certificate or private CA instead. Reverse DNS is not a requirement for an IP SAN.
Steps
1. Confirm the client and the validation route
certbot --version
certbot --help all
Check for --ip-address and profile support. Follow Certbot’s installation instructions if your distribution supplies an older version. The Let’s Encrypt Certbot announcement documents webroot issuance and the required short-lived profile.
This guide uses HTTP-01. Let’s Encrypt’s challenge documentation says HTTP-01 and TLS-ALPN-01 can validate IP addresses, but DNS-01 cannot. Certbot’s webroot workflow answers HTTP-01 using your existing web server, so it does not need to take over port 80.
2. Serve the challenge path on the IP’s HTTP virtual host
On a dedicated origin, add this location inside the existing port 80 server block that handles requests to the IP:
location ^~ /.well-known/acme-challenge/ {
root /var/www/acme;
default_type text/plain;
try_files $uri =404;
}
Create the directory and a harmless reachability check:
sudo mkdir -p /var/www/acme/.well-known/acme-challenge
printf 'acme-reachable\n' | sudo tee /var/www/acme/.well-known/acme-challenge/reachability-check
sudo nginx -t
sudo systemctl reload nginx
curl --fail http://203.0.113.10/.well-known/acme-challenge/reachability-check
Run the last request from another network as well. It must return the test text through the actual public route. Authentication, a blanket redirect to another hostname or a default virtual host can intercept the request. A successful local curl does not prove internet reachability through a router or cloud firewall.
For IPv6 URLs, enclose the literal address in square brackets. Pass the address without brackets to Certbot’s --ip-address option.
3. Rehearse against staging without saving a test certificate
sudo certbot certonly --dry-run \
--preferred-profile shortlived \
--webroot --webroot-path /var/www/acme \
--ip-address 203.0.113.10
Complete the account prompts with your own details. --dry-run uses the staging service for a test issuance and does not save the resulting certificate. Fix any failed challenge before proceeding. Staging certificates are intentionally not publicly trusted; browser trust is not the success criterion for this rehearsal.
4. Issue and install the production certificate
Choose an unused, stable Certbot certificate name for this deployment:
sudo certbot certonly --cert-name ip-origin \
--preferred-profile shortlived \
--webroot --webroot-path /var/www/acme \
--ip-address 203.0.113.10
sudo certbot certificates
You can repeat --ip-address to request additional addresses that you control and can validate. Every requested address must pass validation. Adding an IPv6 address to the certificate does not configure that address on the server.
Use the paths printed by Certbot. With the chosen name, configure the HTTPS server to use:
server {
listen 443 ssl default_server;
server_name _;
ssl_certificate /etc/letsencrypt/live/ip-origin/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/ip-origin/privkey.pem;
location / {
return 200 "IP HTTPS works.\n";
}
}
This is a minimal dedicated IP server example. Adapt your existing default HTTPS block instead of creating two defaults on the same address and port. An IP-literal TLS client may not send a DNS SNI name, so the default certificate for that listening address must cover the IP. Preserve your application’s actual routing and TLS policy.
Test the configuration and reload NGINX. Keep privkey.pem private; do not broaden permissions simply to make a diagnostic work. The NGINX certificate guide explains file placement and reload checks in more detail.
5. Save the reload hook and prove renewal
Issuance with certonly does not configure or reload the web server for you. Save a hook that reloads NGINX only after its configuration passes:
sudo certbot reconfigure --cert-name ip-origin \
--deploy-hook "nginx -t && systemctl reload nginx"
sudo certbot renew --cert-name ip-origin --dry-run --run-deploy-hooks
systemctl list-timers --all
reconfigure tests the new renewal options before saving them. --run-deploy-hooks exercises the hook during the rehearsal; Certbot uses the active certificate for that hook rather than installing the untrusted staging certificate.
Confirm that your installation method actually schedules certbot renew. If it does not, configure renewal through that method’s documented scheduler. Do not schedule --force-renewal repeatedly. Set monitoring to detect both a failed renewal and a failure to deploy a newly issued certificate, with enough time to respond inside the short validity window.
Check it worked
Check the certificate on disk:
sudo openssl x509 -in /etc/letsencrypt/live/ip-origin/cert.pem \
-noout -dates -ext subjectAltName
curl --fail https://203.0.113.10/
openssl s_client -connect 203.0.113.10:443 \
-verify_ip 203.0.113.10 -verify_return_error </dev/null
The SAN must contain an IP Address entry, and both network checks should validate without an exception. Repeat after a real renewal and confirm the served serial or expiry changed. A renewed file alone does not show that NGINX reloaded it.
If something goes wrong
- Unrecognised
--ip-address: update the client;-dis not the replacement for an IP identifier. - Profile or identifier rejected: confirm the requested profile exists and that the address is eligible public address space.
- HTTP challenge fails: inspect the IP’s default HTTP host, port forwarding and exact challenge response.
- Wrong certificate on HTTPS: check the default TLS listener, not only
server_name; IP clients differ from DNS-name clients. - Expires after successful issuance: inspect the timer, renewal logs and reload hook. Do not wait for an email to prove renewal health.
Why this works
ACME proves control of the address and requests a certificate containing an IP SAN. The TLS client checks that the requested IP matches that SAN and that the chain reaches a trusted root. Automatic renewal and server reload complete the certificate lifecycle.
Go deeper
- Let’s Encrypt: IP and short-lived certificate availability.
- Let’s Encrypt: IP certificates with Certbot and profile reference.
- Certbot user guide: dry runs, reconfiguration, renewal and hooks.
Early edition. Written with AI assistance and checked against primary sources; an independent expert review is planned. Found a mistake? Tell us.