Example 1: Single domain.

acme.sh --issue -d example.com -w /home/wwwroot/example.com

or:

acme.sh --issue -d example.com -w /home/username/public_html

or:

acme.sh --issue -d example.com -w /var/www/html

Example 2: Multiple domains in the same cert.

acme.sh --issue -d example.com -d www.example.com -d cp.example.com -w /home/wwwroot/example.com

The parameter /home/wwwroot/example.com or /home/username/public_html or /var/www/html is the web root folder where you host your website files. You MUST have write access to this folder.

Second argument « example.com » is the main domain you want to issue the cert for. You must have at least one domain there.

You must point and bind all the domains to the same webroot dir: /home/wwwroot/example.com.

Generated/issued certs will be placed in ~/.acme.sh/example.com/

The issued cert will be renewed automatically every 60 days.

More examples: https://github.com/Neilpang/acme.sh/wiki/How-to-issue-a-cert

3. Install the issued cert to Apache/Nginx etc.

After you issue a cert, you probably want to install/copy the cert to your Apache/Nginx or other servers. You MUST use this command to copy the certs to the target files, DO NOT use the certs files in ~/.acme.sh/ folder, they are for internal use only, the folder structure may change in the future.

Apache example:

acme.sh --install-cert -d example.com \
--cert-file      /path/to/certfile/in/apache/cert.pem  \
--key-file       /path/to/keyfile/in/apache/key.pem  \
--fullchain-file /path/to/fullchain/certfile/apache/fullchain.pem \
--reloadcmd     "service apache2 force-reload"

Nginx example:

acme.sh --install-cert -d example.com \
--key-file       /path/to/keyfile/in/nginx/key.pem  \
--fullchain-file /path/to/fullchain/nginx/cert.pem \
--reloadcmd     "service nginx force-reload"

Only the domain is required, all the other parameters are optional.

The ownership and permission info of existing files are preserved. You may want to precreate the files to have defined ownership and permission.

Install/copy the issued cert/key to the production Apache or Nginx path.

The cert will be renewed every 60 days by default (which is configurable). Once the cert is renewed, the Apache/Nginx service will be reloaded automatically by the command: service apache2 force-reload or service nginx force-reload.

4. Use Standalone server to issue cert

(requires you to be root/sudoer or have permission to listen on port 80 (TCP))

Port 80 (TCP) MUST be free to listen on, otherwise you will be prompted to free it and try again.

acme.sh --issue --standalone -d example.com -d www.example.com -d cp.example.com

More examples: https://github.com/Neilpang/acme.sh/wiki/How-to-issue-a-cert

5. Use Standalone TLS server to issue cert

(requires you to be root/sudoer or have permission to listen on port 443 (TCP))

acme.sh supports tls-sni-01 validation.

Port 443 (TCP) MUST be free to listen on, otherwise you will be prompted to free it and try again.

acme.sh --issue --tls -d example.com -d www.example.com -d cp.example.com

More examples: https://github.com/Neilpang/acme.sh/wiki/How-to-issue-a-cert

6. Use Apache mode

(requires you to be root/sudoer, since it is required to interact with Apache server)

If you are running a web server, Apache or Nginx, it is recommended to use the Webroot mode.

Particularly, if you are running an Apache server, you should use Apache mode instead. This mode doesn’t write any files to your web root folder.

Just set string « apache » as the second argument and it will force use of apache plugin automatically.

acme.sh --issue --apache -d example.com -d www.example.com -d cp.example.com

More examples: https://github.com/Neilpang/acme.sh/wiki/How-to-issue-a-cert

7. Use Nginx mode

(requires you to be root/sudoer, since it is required to interact with Nginx server)

If you are running a web server, Apache or Nginx, it is recommended to use the Webroot mode.

Particularly, if you are running an nginx server, you can use nginx mode instead. This mode doesn’t write any files to your web root folder.

Just set string « nginx » as the second argument.

It will configure nginx server automatically to verify the domain and then restore the nginx config to the original version.

So, the config is not changed.

acme.sh --issue --nginx -d example.com -d www.example.com -d cp.example.com

More examples: https://github.com/Neilpang/acme.sh/wiki/How-to-issue-a-cert

8. Use DNS mode:

Support the dns-01 challenge.

acme.sh --issue --dns -d example.com -d www.example.com -d cp.example.com

You should get an output like below:

Add the following txt record:
Domain:_acme-challenge.example.com
Txt value:9ihDbjYfTExAYeDs4DBUeuTo18KBzwvTEjUnSwd32-c

Add the following txt record:
Domain:_acme-challenge.www.example.com
Txt value:9ihDbjxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Please add those txt records to the domains. Waiting for the dns to take effect.

Then just rerun with renew argument:

acme.sh --renew -d example.com