ERPNext Domain Change / SSL Handling — ERPnext v12 VPS
Key Rule (Must Remember)
Any time you run
bench setup nginx, SSL is removed from Nginx.
You MUST re-run Certbot immediately after.
Correct Steps to Change / Add / Remove a Domain
-
Update DNS
-
Point domain to the correct server IP
-
Confirm with:
ping yourdomain.com
-
-
Update domain in ERPNext
bench setup add-domain yourdomain.com --site yoursite # or bench setup remove-domain olddomain.com --site yoursite -
Regenerate Nginx (required)
bench setup nginx sudo nginx -t sudo systemctl reload nginx -
Re-enable SSL (always required after step 3)
sudo certbot --nginx -d yourdomain.com \ -m your@email.com --agree-tos --redirect -n -
Verify
curl -I https://yourdomain.com
Important Notes
-
SSL did not expire if HTTPS suddenly stops
-
bench setup nginxoverwrites Certbot SSL config -
Certificates remain valid, but Nginx stops listening on port 443
-
Solution is always: run Certbot again