Linux command
certbot 命令
安全
权限或系统影响较大,执行前请核对目标。
常用示例
Example
sudo certbot certonly --webroot -w [path/to/webroot] -d [subdomain.example.com]
Example
sudo certbot --nginx -d [subdomain.example.com]
Example
sudo certbot --apache -d [subdomain.example.com]
Renew
sudo certbot renew
Dry run
sudo certbot --webroot -w [path/to/webroot] -d [subdomain.example.com] --dry-run
Obtain certificate
sudo certbot certonly --standalone -d [subdomain.example.com]
List all managed certificates
sudo certbot certificates
说明
certbot is the official Let's Encrypt client for automatically obtaining and renewing free TLS/SSL certificates. It can configure web servers like Apache and Nginx automatically. Certificates are valid for 90 days. The renew command should be run regularly (typically via cron) to maintain valid certificates.
参数
- -d, --domain _domain_
- Domain name for certificate
- -w, --webroot-path _path_
- Webroot path for validation
- --nginx
- Use nginx plugin
- --apache
- Use apache plugin
- --dry-run
- Test without saving
- --standalone
- Use built-in web server for validation
- --test-cert
- Use staging server (untrusted certificates)
- --non-interactive
- Run without user interaction
- --agree-tos
- Agree to terms of service
- -m, --email _email_
- Email for account registration
- --preferred-challenges _type_
- Preferred challenge type: http-01, dns-01, or tls-alpn-01
- --deploy-hook _command_
- Command to run after successful certificate deployment (e.g., reload web server)
FAQ
What is the certbot command used for?
certbot is the official Let's Encrypt client for automatically obtaining and renewing free TLS/SSL certificates. It can configure web servers like Apache and Nginx automatically. Certificates are valid for 90 days. The renew command should be run regularly (typically via cron) to maintain valid certificates.
How do I run a basic certbot example?
Run `sudo certbot certonly --webroot -w [path/to/webroot] -d [subdomain.example.com]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -d, --domain _domain_ do in certbot?
Domain name for certificate