certbot使用笔记
安装
CentOsyumyinstallcertbotpython2certbotnginx
Ubuntuaptgetinstallcertbotpythoncertbotnginx部署https证书
nginx配置在etcnginxconfnginx。conf时certbotnginx
nginx配置文件不在etcnginxconfnginx。conf下时certbotnginxnginxserverrootusrlocalnginxconf需要使用nginxserverroot指定nginx配置文件所在的目录(不用输入nginx。conf,会自动拼接),必须使用绝对路径如果使用certbotnginxserverroot。nginx。conf会把当前目录拼接。nginx。conf,如usrlocalnginx。nginx。confnginx。conf
直接指定域名certbotnginxdexample。comdexample2。com
https证书过期自动生成并重新加载crontabe012usrbincertbotrenewquietquiet选项不会生成输入(每天中午12点自动对还剩30天过期的证书重新生成并且重载)指定配置文件的方式012usrbincertbotnginxserverrootusrlocalnginxconfrenewquiet安装过程翻译
第一次使用需要输入邮箱Savingdebuglogtovarlogletsencryptletsencrypt。logPluginsselected:Authenticatornginx,InstallernginxEnteremailaddress(usedforurgentrenewalandsecuritynotices)(Enterctocancel):1234567qq。comStartingnewHTTPSconnection(1):acmev02。api。letsencrypt。org
是否同意协议PleasereadtheTermsofServiceathttps:letsencrypt。orgdocumentsLESAv1。3September212022。pdf。YoumustagreeinordertoregisterwiththeACMEserver。Doyouagree?(Y)es(N)o:y
是否同意接受certbot基金组织活动邮件通知Wouldyoubewilling,onceyourfirstcertificateissuccessfullyissued,toshareyouremailaddresswiththeElectronicFrontierFoundation,afoundingpartneroftheLetsEncryptprojectandthenonprofitorganizationthatdevelopsCertbot?Wedliketosendyouemailaboutourworkencryptingtheweb,EFFnews,campaigns,andwaystosupportdigitalfreedom(Y)es(N)o:yAccountregistered。
选择需要激活的https域名WhichnameswouldyouliketoactivateHTTPSfor?1:a。example。com2:b。example。com3:c。example。com4:d。example。com
请求域名证书注册Selecttheappropriatenumbersseparatedbycommasandorspaces,orleaveinputblanktoselectalloptionsshown(Enterctocancel):4Requestingacertificateford。example。comPerformingthefollowingchallenges:http01challengeford。example。comWaitingforverification。。。CleaningupchallengesDeployingCertificatetoVirtualHostusrlocalnginxconfvhostcom。example。d。nginx。confRedirectingalltrafficonport80tosslinusrlocalnginxconfvhostcom。example。d。nginx。conf
配置成功,返回证书文件位置及证书过期时间和重新激活证书命令IMPORTANTNOTES:Congratulations!Yourcertificateandchainhavebeensavedat:etcletsencryptlived。example。comfullchain。pemYourkeyfilehasbeensavedat:etcletsencryptlived。example。comprivkey。pemYourcertificatewillexpireon20230206。Toobtainanewortweakedversionofthiscertificateinthefuture,simplyruncertbotagainwiththecertonlyoption。Tononinteractivelyrenewallofyourcertificates,runcertbotrenewIfyoulikeCertbot,pleaseconsidersupportingourworkby:DonatingtoISRGLetsEncrypt:https:letsencrypt。orgdonateDonatingtoEFF:https:eff。orgdonatele