時間:2022-07-24 12:36:01 | 來源:網(wǎng)站運營
時間:2022-07-24 12:36:01 來源:網(wǎng)站運營
wget https://dl.eff.org/certbot-autochmod a+x certbot-auto
使用certbot申請安裝證書:./certbot-auto certonly --webroot --apache -w /data/wwwroot/www.chanzhi cms.com -d www.chanzhicms.com --no-self-upgrade
-w后面是網(wǎng)站的根目錄路徑,-d后面是申請證書的域名,多個域名的話,在后面繼續(xù)添加設置多個-d即可。LoadModule ssl_module modules/mod_ssl.soInclude conf/extra/httpd-ssl.conf然后修改/usr/local/apache/conf/extra/httpd-ssl.conf 文件,將里面內(nèi)容清空,放入下面內(nèi)容:Listen 443AddType application/x-x509-ca-cert .crtAddType application/x-pkcs7-crl .crlSSLCipherSuite EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5SSLProxyCipherSuite EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5SSLHonorCipherOrder onSSLProtocol all -SSLv2 -SSLv3SSLProxyProtocol all -SSLv2 -SSLv3SSLPassPhraseDialog builtinSSLSessionCache "shmcb:/usr/local/apache/logs/ssl_scache(512000)"SSLSessionCacheTimeout 300Mutex sysvsem defaultSSLStrictSNIVHostCheck on
最后修改網(wǎng)站的單獨配置文件,/usr/local/apache/conf/vhost/www.chanzhicm.com.conf ,原本只有80端口配置,這里需要我們加上443端口的配置: ServerAdmin admin@linuxeye.com DocumentRoot "/data/wwwroot/www.chanzhicms.com" ServerName www.chanzhicms.com ServerAlias chanzhicms.com ErrorLog "/data/wwwlogs/www.chanzhicms.com_error_apache.log" CustomLog "/data/wwwlogs/www.chanzhicms.com_apache.log" combined SetOutputFilter DEFLATE Options FollowSymLinks ExecCGI Require all granted AllowOverride All Order allow,deny Allow from all DirectoryIndex index.html index.phpListen 443 DocumentRoot "/data/wwwroot/www.chanzhicms.com" ServerName www.chanzhicms.com:443 ServerAlias www.chanzhicms.com ErrorLog "/data/wwwlogs/www.chanzhicms.com_error_apache.log" ServerAdmin admin@linuxeye.com SSLEngine on SSLCertificateFile /etc/letsencrypt/live/www.chanzhicms.com/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/www.chanzhicms.com/privkey.pem SetOutputFilter DEFLATE Options FollowSymLinks AllowOverride All Order allow,deny Allow from all DirectoryIndex index.html index.php Require all granted
上面配置中的網(wǎng)站名稱、網(wǎng)站路徑、證書路徑等信息,大家根據(jù)自己的具體情況填寫。certbot-auto renew --no-self-upgrade
成功后,檢查更新到期日期./certbot-auto certificates
證書到期之前會有郵件提醒,這里介紹修改新訂閱郵箱的方法:./certbot-auto update_account --email 963370407@qq.com --no-self-upgrade
yum install vixie-cron crontabs //安裝Crontabchkconfig crond on //設為開機自啟動service crond start //啟動
/var/spool/cron 這里是所有的自動執(zhí)行任務的 cron 文件存放位置(root文件)30 20 1 * * /root/certbot-auto renew --no-self-upgrade
即每月1號晚上8點半更新證書。service crond restart
查看crontab定時執(zhí)行任務列表crontab -l
vim ~/.pip/pip.conf[global]index-url=https://pypi.tuna.tsinghua.edu.cn/simple/[install]trusted-host=pypi.tuna.tsinghua.edu.cn
改保存后,再試試 ./certbot-auto renew --no-self-upgrade 就正常了。Attempting to renew cert (www.chanzhicms.com) from /etc/letsencrypt/renewal/www.chanzhicms.com.conf produced an unexpected error: The manual plugin is not working; there may be problems with your existing configuration.The error was: PluginError('An authentication script must be provided with --manual-auth-hook when using the manual plugin non-interactively.',). Skipping.All renewal attempts failed. The following certs could not be renewed: /etc/letsencrypt/live/www.chanzhicms.com/fullchain.pem (failure)
解決方法:vim /etc/letsencrypt/renewal/www.chanzhicms.com.sh#!/bin/bashecho $CERTBOT_VALIDATION > /path/to/wwwroot/.well-known/acme-challenge/$CERTBOT_TOKEN
其中,/path/to/wwwroot/ 為您域名驗證的網(wǎng)站根目錄chmod +x /etc/letsencrypt/renewal/www.chanzhicms.com.sh
帶參數(shù)執(zhí)行命令certbot-auto renew --no-self-upgrade --manual-auth-hook /etc/letsencrypt/renewal/www.chanzhicms.com.sh
成功后,檢查更新到期日期./certbot-auto certificates --no-self-upgrade
關鍵詞:證書,升級,申請
微信公眾號
版權所有? 億企邦 1997-2025 保留一切法律許可權利。