## Generating a Certificate with Acme.sh
This document provides instructions on how to use the `acme.sh` command-line tool to generate a certificate for a single domain or multiple domains.
### Prerequisites
* Install `acme.sh` from the official repository: `git clone -r acme.sh`
* Make sure you have basic command-line knowledge.
### Single Domain Mode
1. Point the domain name and its subdomain to the same web root folder:
```
acme.sh --issue -d example.com -w /home/wwwroot/example.com
```
2. This mode requires write access only to the web root folder.
### Standalone Mode
1. Run the command with the `--standalone` flag:
```
acme.sh --issue -d example.com --standalone
```
2. This mode allows you to issue the certificate without needing a web server.
### TLS Alpn Mode
1. Ensure your web server supports TLS/SSL by setting the `--tlsport` flag.
2. Use the `--alpn` flag to specify the desired port for TLS/SSL.
3. Example:
```
acme.sh --issue -d example.com --alpn --tlsport 84434
```
### DNS API Mode
1. Set the `--dns` flag followed by the subdomain names.
2. Use the `--dns_cf` or `--dns_ns` flag for CloudFlare and Namecheap respectively.
3. Example:
```
acme.sh --issue -d example.com --dns dns_cf
```
### DNS Manual Mode
1. Use the `--dns` flag followed by the subdomain name.
2. Use the `--nginx` flag to specify the nginx configuration file path.
3. Example:
```
acme.sh --issue -d example.com --dns dns_manual
```
### Apache Mode
1. Use the `--issue` flag followed by the domain name.
2. Use the `--nginx` flag to specify the nginx configuration file path.
3. Example:
```
acme.sh --issue -d example.com --nginx /etc/nginx/conf.d/example.com.conf
```
### Nginx Mode
1. Use the `--issue` flag followed by the domain name.
2. Use the `--nginx` flag to specify the nginx configuration file path.
3. Example:
```
acme.sh --issue -d example.com --nginx /etc/nginx/nginx.conf
```
If you don't have a web server, maybe you are on a smtp or ftp server, the 80 port is free. you can use standalone mode. acme.sh has a builtin standalone webserver, it can listen at 80 port to issue the cert.
acme.sh --issue -d example.com --standalone
If you are using a non-standard 80 port behind a reverse proxy or load balancer , you can use --httpport to specify your port:
If you don't have a web server, maybe you are on a smtp or ftp server, the 443 port is free. you can use standalone tls alpn mode. acme.sh has a builtin standalone tls webserver, it can listen at 443 port to issue the cert.
acme.sh --issue -d example.com --alpn
If you are using a non-standard 443 port behind a reverse proxy or load balancer , you can use --tlsport to specify your port:
Yes, if your nameservice provider has an api, we can use the api to automatically add the txt record for you. your cert will be automatically issued and renewed.
If your website is running apache server, acme.sh can use apache server to issue cert. And acme.sh will restore your apache conf after the cert is issued, don't worry.
acme.sh --issue -d example.com --apache
8) Nginx mode:
If your website is running nginx server, acme.sh can use nginx server to issue cert. And acme.sh will restore your nginx conf after the cert is issued, don't worry.
acme.sh --issue -d example.com --nginx
Sometimes, nginx conf file can not be found automatically, you can specify one: