linux使用certbot 自己生成证书apache版

1.获取certbot-auto

wget https://dl.eff.org/certbot-auto

2.添加执行权限

chmod a+x certbot-auto

3.自动下载和安装环境需要的组件

 ./certbot-auto --apache certonly

4.生成域名所需要的证书(红色部分为网站访问的路径和需要生成证书的域名)

./certbot-auto certonly --email  123456@qq.com --agree-tos --webroot -w  /www/web/blxz/public_html  -d  blxz.qq.cn

5.生成的路径应该是(应该是四个证书文件):

/etc/letsencrypt/live/blxz.qq.com/privkey.pem

6.配置apache文件(vhost的域名配置文件.conf)

<VirtualHost *:443>
DocumentRoot /www/web/blxz/public_html
ServerName blxz.qq.com
ServerAlias blxz.qq.com
ErrorDocument 400 /errpage/400.html
ErrorDocument 403 /errpage/403.html
ErrorDocument 404 /errpage/404.html
SSLEngine on
SSLCertificateFile          /etc/letsencrypt/live/blxz.qq.com/cert.pem
SSLCertificateKeyFile       /etc/letsencrypt/live/blxz.qq.com/privkey.pem
SSLCertificateChainFile     /etc/letsencrypt/live/blxz.qq.com/chain.pem


php_admin_value open_basedir /www/web/blxz:/tmp
<IfModule mod_deflate.c>
DeflateCompressionLevel 7
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/x-httpd-php
AddOutputFilter DEFLATE css js html htm gif jpg png bmp php
</IfModule>
</VirtualHost>
<Directory /www/web/blxz>
    Options FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

7.重启apache配置

service httpd restart

 

注意:certbot  Let's Encrypt永久免费但需要90天激活一次续约

 

转载于:https://www.cnblogs.com/feimengv/p/8391494.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值