Caddy是一个由Go言语编写的Web任职器软件,可能自愿竣工HTTPS摆设。
为甚么应用Caddy
本身的博客思要应用https,懒得去更新证书,Caddy可能火速处置我的题目。
并且比拟nginx,Caddy摆设起来更粗略,就一个二进制文献;
CaddyFile设备更粗略,良众都是默许设备,只有凭据本身的状况,增添需求的参数便可。
功效厚实,然而良众我姑且用不到,用到再经由过程插件的式样增添便可。
对待一个博客使用来讲全部够用了。
装置Caddy
正在CentOS上可能直策应用yum装置的,也可如下载对应平台的二进制举办装置。
装置号召:
yuminstallyum-plugin-copr-yyumcoprenable@caddy/caddy-yyuminstallcaddy-y
设备
设备文献默许是正在/etc/caddy/Caddyfile,设备文献只有删改好本身的域名,即使需求https直接填写上http://xxx便可能了,root实践本身的网站目次便可。
我的网站是hugo天生的静态站,直接设备目次。
即使是php可能直接转发的php_fastcgi。
#TheCaddyfileisaneasywaytoconfigureyourCaddywebserver.##Unlessthefilestartswithaglobaloptionsblock,thefirst#unco妹妹entedlineisalwaystheaddressofyoursite.##Touseyourowndomainname(withautomaticHTTPS),firstmake#sureyourdomainsA/AAAADNSrecordsareproperlypointedto#thismachinespublicIP,thenreplace":80"belowwithyour#domainname.www.opcai.tophttps://www.opcai.tophttp://opcai.tophttps://opcai.top{#Setthispathtoyoursitesdirectory.root*/data/webroot#Enablethestaticfileserver.file_server#Anotherco妹妹ontaskistosetupareverseproxy:#reverse_proxy/back/*localhost:8080#OrserveaPHPsitethroughphp-fpm:#php_fastcgilocalhost:9000}#RefertotheCaddydocsformoreinformation:#https://caddyserver.com/docs/caddyfile
任职治理
systemctlenable--nowcaddy#启动并扶植开机启动systemctlreloadcaddy#重载设备
总结
Caddy又有良众重大的功效,逐步找寻。
文章推荐: