CentOS 7 自动续期SSL证书
systemctl 命令详解
systemctl 是系统服务管理器命令,用于管理系统服务。
-
启动服务
systemctl start nginx -
停止服务
systemctl stop nginx -
重启服务
systemctl restart nginx -
重新加载配置
systemctl reload nginx -
查看服务状态
systemctl status nginx -
设置开机自启
systemctl enable nginx -
禁用开机自启
systemctl disable nginx
firewall-cmd 防火墙命令详解
-
启动防火墙
systemctl start firewalld -
开放端口
firewall-cmd --permanent --add-port=80/tcp -
开放服务
firewall-cmd --permanent --add-service=http -
重载防火墙规则
firewall-cmd --reload -
查看所有规则
firewall-cmd --list-all
nginx 命令详解
-
测试配置文件
nginx -t -
重新加载配置
nginx -s reload -
立即停止
nginx -s stop -
优雅停止
nginx -s quit
certbot 证书命令详解
-
申请证书
certbot --nginx -d domain.com -
查看证书
certbot certificates -
测试续期
certbot renew --dry-run -
手动续期
certbot renew
为什么需要这些命令?
-
systemctl用于管理系统服务,确保服务稳定运行,以及控制服务是否开机自启动。 -
firewall-cmd用于保护服务器安全,控制端口和服务的网络访问,以及管理防火墙规则。 -
nginx用于管理网站服务,包括更新配置文件和保证服务平滑运行。 -
certbot用于SSL证书管理,包括自动续期以保证HTTPS的安全性。
这些命令是服务器维护的基础工具,掌握它们可以帮助您更好地管理和维护您的服务器。