0x00
感觉有一把小锁头比较舒服。
0x01
因为自己的服务器系统是 ubuntu 16.04 所以就只是了解关于这个系统下 apache 的 ssl 证书配置
我的域名是在阿里云买的。所以在阿里云申请 ssl 证书
然后上传到服务器 /etc/apache2/cert 目录 目录随意
配置 /etc/apache2/site-available/default-ssl.conf 文件
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerAdmin xxxx@xxx.cn
ServerName test.ronething.top
ServerAlias test.ronething.top
DocumentRoot /var/www/projectdir
SSLEngine on
# 下面这三行是关键。
SSLCertificateFile /etc/apache2/cert/public.pem
SSLCertificateKeyFile /etc/apache2/cert/your.key
SSLCertificateChainFile /etc/apache2/cert/chain.pem
<Directory "/var/www/projectdir/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Order allow,deny
Allow from all
Require all granted
#Require local
</Directory>
</VirtualHost>
</IfModule>
完成之后 创建 site-enabled 指向 site-available 的软链接 并开启 apache2 ssl 模块
sudo ln -s /etc/apache2/sites-available/default-ssl.conf /etc/apache2/sites-enabled/001-ssl.conf
sudo a2enmod ssl
最后重启 apache2 服务
sudo systemctl restart apache2.service
大功告成,访问试试吧。
0x02
参考资料:https://www.jianshu.com/p/f95bcd8c7933
封面出处:https://www.pixiv.net/member_illust.php?mode=medium&illust_id=74765883