已经安装好apache,mysql和python
1、安装mod_ssl模块
yum -y install mod_ssl
2、安装epel-release
yum -y install epel-release
3、安装snapd,并设置开机启动
yum -y install snapd
systemctl enable --now snapd
sudo snap install core
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/local/bin/certbot
4、配置ssl模块和apache虚拟机
vim /etc/httpd/conf/httpd.conf
在配置文件中添加/确认以下行,如果已存在就不用动
LoadModule ssl_module modules/mod_ssl.so
编辑配置文件
[root@aspfj738vhd034j ~]# cat /etc/httpd/conf.d/liuchunjie.top.conf
<VirtualHost *:80>
ServerName liuchunjie.top
ServerAlias www.liuchunjie.top
DocumentRoot /var/www//html
<Directory /var/www//html>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
# CentOS 日志路径不同
ErrorLog /var/log/httpd/liuchunjie.top_error.log
CustomLog /var/log/httpd/liuchunjie.top_access.log combined
5、配置证书
certbot --apache -d liuchunjie.top -d www.liuchunjie.top