Manual acme.sh

O's World

Generate Cloudflare DNS certificate commands and Nginx certificate configuration locally.

Run steps 1–4 in order in the same shell on your server with acme.sh installed and Cloudflare DNS configured. The reload command assumes Nginx is managed by systemd.

1 · Cloudflare token

Read-only template with one leading space before export. Fill in your token in the terminal before running.

 export CF_Token=""

2 · Issue certificate

acme.sh --issue \
  --dns dns_cf \
  -d example.com \
  --keylength ec-256

3 · Create directory

mkdir -p /etc/nginx/ssl/example.com

4 · Install certificate

acme.sh --install-cert -d example.com --ecc \
  --key-file /etc/nginx/ssl/example.com/privkey.pem \
  --fullchain-file /etc/nginx/ssl/example.com/fullchain.pem \
  --reloadcmd "systemctl reload nginx"

Nginx certificate configuration

ssl_certificate /etc/nginx/ssl/example.com/fullchain.pem;
ssl_certificate_key /etc/nginx/ssl/example.com/privkey.pem;

Common paths & commands

Certificate paths follow your inputs. Common Linux paths may differ by installation. Run commands on your server with the required permissions.

Optional: DH parameters are for DHE ciphers, not required for ECDHE. Generate the file before adding ssl_dhparam; generation may take time. The command skips an existing file.

Private key

/etc/nginx/ssl/example.com/privkey.pem

Certificate and intermediate chain

/etc/nginx/ssl/example.com/fullchain.pem

DH parameters

/etc/nginx/ssl/dhparam.pem

Generate DH parameters (2048 bits)

mkdir -p /etc/nginx/ssl/ && if [ ! -e /etc/nginx/ssl/dhparam.pem ]; then
  openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
fi

Nginx DH parameter directive

ssl_dhparam /etc/nginx/ssl/dhparam.pem;

Inspect certificate subject, issuer and dates

openssl x509 -in /etc/nginx/ssl/example.com/fullchain.pem -noout -subject -issuer -dates

Check whether certificate expires within 30 days

openssl x509 -in /etc/nginx/ssl/example.com/fullchain.pem -noout -checkend 2592000

Nginx main configuration (common path)

/etc/nginx/nginx.conf

acme.sh working directory (default)

~/.acme.sh/

Test Nginx configuration

nginx -t

Test and reload Nginx (systemd)

nginx -t && systemctl reload nginx