banner
Geek

Geek

🧠在家居士 | 🥦素食者 | 🏃🏻马拉松爱好者 | 📡AI降临派 | 过🪜技术资深学者 | 🤖科技狂 | 📤更新狂🆅 https://www.igeekbb.com/
twitter
github

Quickly obtain SSL wildcard subdomain certificates - acme.sh

Tools Used#


Notes#

The following operations are based on changing the NS records of the domain to Cloudflare's NS and having Cloudflare host it.

Manual DNS Verification Method#

1. Install acme.sh#

  • Open SSH and enter the following command to install acme.sh (Note: Change the Email address to your registered Cloudflare email)
curl https://get.acme.sh | sh -s [email protected]

CleanShot 2023-04-15 at 15.58.58 2@2x.png


2. Run the script for manual DNS verification#

  • Let's apply for a wildcard second-level domain (*.198406.xyz) SSL certificate using my 198406.xyz as an example. Change the code below to your own domain.
acme.sh --issue --dns -d "*.198406.xyz" --yes-I-know-dns-manual-mode-enough-go-ahead-please

CleanShot 2023-04-15 at 16.00.54@2x.png

Record all the values of Domain and TXT value above (highlighted in yellow)


3. Add TXT record in Cloudflare#

  • Add a TXT record in Cloudflare for domain management

CleanShot 2023-04-15 at 16.02.34 2@2x.png

  • Wait for 1 min for it to take effect

4. Run the application script#

  • (Remember to change it to your own domain)
acme.sh --renew --dns -d "*.198406.xyz" --yes-I-know-dns-manual-mode-enough-go-ahead-please

CleanShot 2023-04-15 at 16.03.26 2@2x.png

  • Successfully applied for the wildcard second-level domain certificate for *.198406.xyz

5. Secure handling of domain certificates#

  • Save the pem domain files to /root/cert/ (change the domain, create the file directory first)
acme.sh --install-cert -d "*.198406.xyz" \ 
--key-file       /root/cert/key.pem  \
--fullchain-file /root/cert/cert.pem \
--reloadcmd     "service nginx force-reload"

CleanShot 2023-04-15 at 16.04.50 2@2x.png


Done
CleanShot 2023-04-15 at 19.24.25 2@2x.png

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.