caddy1服务启动报错问题

纯粹口水一下caddy1遇上的启动报错问题.

报错内容如下

   Process: 472999 ExecStart=/usr/bin/caddy -conf /etc/caddy/caddy.conf -root /tmp -agree (code=exited, status=1/FAILURE)
   Main PID: 472999 (code=exited, status=1/FAILURE)
        CPU: 26ms

Aug 12 11:48:36 klayer systemd[1]: Starting Caddy HTTP/2 web server...
Aug 12 11:48:36 klayer caddy[472992]: Caddyfile is valid
Aug 12 11:48:36 klayer systemd[1]: Started Caddy HTTP/2 web server.
Aug 12 11:48:36 klayer caddy[472999]: Activating privacy features... 2023/08/12 11:48:36 failed storage check: open /var/lib/caddy/rw_test_1203782840230465039>
Aug 12 11:48:36 klayer systemd[1]: caddy.service: Main process exited, code=exited, status=1/FAILURE
Aug 12 11:48:36 klayer systemd[1]: caddy.service: Failed with result 'exit-code'.

 

解决如下

ulimit -n 8192
cat>>/etc/security/limits.conf<<EOF

* soft nofile 65535
* hard nofile 65535
* soft nproc 65535
* hard nproc 65535

root soft nofile 65535
root hard nofile 65535
root soft nproc 65535
root hard nproc 65535

EOF

useradd  -M  caddy -s /sbin/nologin
mkdir /var/lib/caddy
chown caddy.caddy  /var/lib/caddy

 

一个是limits系统参数问题,一个/var/lib/caddy目录问题, 如果caddy用户给root权限就没第二个问题.

Centos8安装部署Caddy2以及typecho/wordpress伪静态

Centos8(Caddy2)

yum -y -q install epel-release
yum -y copr enable @caddy/caddy
yum -y -q install caddy


/etc/caddy/Caddyfile的typecho配置例子

DOMAIN='blog.domian'
cat>/etc/caddy/Caddyfile<<EOF
${DOMAIN}, www.${DOMAIN}
{
   tls admin@${DOMAIN}
   root * /home/${DOMAIN}/
   encode gzip
   file_server
   php_fastcgi unix//dev/shm/php-fpm.sock
   handle_path / {   try_files {path} {path}/index.php?{query} index.php?{query}  }
}
EOF

“域名.后缀”  替换成自己的域名

/dev/shm/php-fpm.sock换成自己的php-fpm路径

多个域名用逗号和空格隔开, 可以绑定多个域名.

php自己安装配置, Caddyfile配置已经验证可用.

Centos7安装Caddy

用caddy自动续签ssl太爽了, 之前编译安装太费心了,现在可以直接从epel安装.

但是如果要做4层协议转发,还是没有nginx效率强大.

Centos7

yum -y -q install epel-release
yum -y -q install caddy

阅读剩余部分...

Centos下安装部署Vaultwarden和Caddy1

Bitwarden的一个开放项目Vaultwarden基于rust编写, 可以使用Bitwarden的浏览器插件然后配置使用自建的服务器.

Caddy比nginx配置更简单自动SSL方便, teddy有编译好直接拿来用.

 注意:小内存编译需要4GB的swap

配套资料

官方资源页面: https://bitwarden.com/download/

Windows桌面软件: https://vault.bitwarden.com/download/?app=desktop&platform=windows
MacOS APP安装: https://itunes.apple.com/app/bitwarden/id1352778147
Chrome插件: https://chrome.google.com/webstore/detail/bitwarden-free-password-m/nngceckbapebfimnlniiiahkandclblb
Firefox插件: https://addons.mozilla.org/firefox/addon/bitwarden-password-manager/
微软EDGE插件: https://microsoftedge.microsoft.com/addons/detail/jbkfoedolllekgbhcbcoahefnbanhhlh

阅读剩余部分...