Centos8通过dnf安装certbot,设置nginx自启动

将centos8的软件库改为stream的

dnf --disablerepo '*' --enablerepo=extras swap centos-linux-repos centos-stream-repos

 

如果centos8默认软件包里没有certbot,就需要更新软件包:

dnf install epel-release
dnf upgrade

一般更新包后就可以安装了

dnf install certbot

nginx安装后设置自启动:

1、一般使用systemctl enable nginx,如果这个命令无效,可以使用其他的方法

2、直接修订文件/etc/rc.local,添加nginx启动命令即可(不推荐)

3、使用chkconfig(未亲测)
在/etc/init.d目录下新建一个脚本nginx.sh并设置执行权限,脚本开头加入以下代码:

#!/bin/sh
#chkconfig:2345 80 90
#description:自定义的脚本描述如nginx

#chkconfig:后面的数字暂不了解含义。
使用chkconfig命令将脚本添加到开机启动

chkconfig --add nginx.sh
chkconfig nginx.sh on

4、在/etc/profile.d/添加新脚本nginx.sh,不用设置执行权限(每次本账户登录都会执行一次)

service nginx start

 

posted @   刘镇维  阅读(307)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
点击右上角即可分享
微信分享提示