惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

美团技术团队
罗磊的独立博客
SecWiki News
SecWiki News
The Register - Security
The Register - Security
The GitHub Blog
The GitHub Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
S
Schneier on Security
IT之家
IT之家
博客园 - 聂微东
T
The Exploit Database - CXSecurity.com
Recorded Future
Recorded Future
大猫的无限游戏
大猫的无限游戏
Know Your Adversary
Know Your Adversary
Latest news
Latest news
Vercel News
Vercel News
G
GRAHAM CLULEY
D
DataBreaches.Net
D
Darknet – Hacking Tools, Hacker News & Cyber Security
S
SegmentFault 最新的问题
博客园_首页
雷峰网
雷峰网
T
Tenable Blog
Spread Privacy
Spread Privacy
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
酷 壳 – CoolShell
酷 壳 – CoolShell
Cisco Talos Blog
Cisco Talos Blog
V
Visual Studio Blog
J
Java Code Geeks
博客园 - Franky
The Cloudflare Blog
Apple Machine Learning Research
Apple Machine Learning Research
C
CERT Recently Published Vulnerability Notes
T
Threatpost
Google DeepMind News
Google DeepMind News
F
Fortinet All Blogs
P
Privacy International News Feed
T
Threat Research - Cisco Blogs
T
The Blog of Author Tim Ferriss
V
Vulnerabilities – Threatpost
Recent Announcements
Recent Announcements
Blog — PlanetScale
Blog — PlanetScale
Security Latest
Security Latest
U
Unit 42
M
MIT News - Artificial intelligence
Y
Y Combinator Blog
K
Kaspersky official blog
有赞技术团队
有赞技术团队
B
Blog
腾讯CDC

Rat's Blog - Caddy

使用Caddy申请免费的Let’s Encrypt泛域名SSL证书 - Rat's Blog Caddy环境下一些Web应用程序的配置参考 - Rat's Blog Caddy环境下WordPress博客伪静态设置 - Rat's Blog Aria2+Caddy+Rclone+GDlist+Aria2Ng+Google Drive一键安装脚本 - Rat's Blog Linux VPS使用Python/Caddy快速搭建文件分享平台 - Rat's Blog Ghost博客一键安装脚本,使用Caddy作为反向代理,并自动签发SSL证书 - Rat's Blog 利用Caddy快速简单的部署反向代理/镜像,自动签发SSL证书 - Rat's Blog 利用Caddy快速搭建Aria2控制前端webui-aria2或者AriaNg - Rat's Blog Caddy Web Server一键管理(开始/停止/安装/更新/卸载)脚本 - Rat's Blog
小内存VPS安装Caddy+PHP 7+Sqlite 3环境,并快速搭建Typecho博客 - Rat's Blog
博主: Rat's · 2018-06-15 · via Rat's Blog - Caddy

说明:我们一般搭建博客的方法就是使用lnmplamp等一键包,或者宝塔等面板来搭建Web环境,不过都只适合大点内存的VPS服务器,小点的比如96M128M服务器就不行了,这时候我们就可以通过安装其它环境来搭建网站环境了,这里博主就说下Caddy+PHP7+Sqlite3安装教程,3分钟就可以搭建一个Typecho博客,并成功运行在96MVPS服务器上,至于96M以下的服务器就不测试了,毕竟很少见了。

安装

教程只写Debian 8、9,建议选择mini版。如果你是96M或者128MKVM建议增加点Swap,教程查看:VPS添加Swap虚拟内存

1、安装PHP 7和Sqlite 3

#Debian 8系统
#添加源
echo "deb http://packages.dotdeb.org jessie all" | tee --append /etc/apt/sources.list
echo "deb-src http://packages.dotdeb.org jessie all" | tee --append /etc/apt/sources.list
#添加key
wget --no-check-certificate https://www.dotdeb.org/dotdeb.gpg
apt-key add dotdeb.gpg
#更新系统
apt-get update -y
#安装PHP 7和Sqlite 3
apt-get install php7.0-cgi php7.0-fpm php7.0-curl php7.0-gd php7.0-mbstring php7.0-xml php7.0-sqlite3 sqlite3 -y

#Debian 9系统
#更新系统
apt-get update -y
#安装PHP 7和Sqlite 3
apt-get install php7.0-cgi php7.0-fpm php7.0-curl php7.0-gd php7.0-mbstring php7.0-xml php7.0-sqlite3 sqlite3 -y

2、安装Caddy
这里直接使用逗比的一键脚本。

wget -N --no-check-certificate https://raw.githubusercontent.com/iiiiiii1/doubi/master/caddy_install.sh && chmod +x caddy_install.sh && bash caddy_install.sh
#备用地址
wget -N --no-check-certificate https://www.moerats.com/usr/shell/Caddy/caddy_install.sh && chmod +x caddy_install.sh && bash caddy_install.sh

3、下载Typecho

mkdir /typecho && cd /typecho
#以下为最新稳定版
wget http://typecho.org/downloads/1.1-17.10.30-release.tar.gz
tar zxvf 1.1*
mv ./build/* ./
rm -rf 1.1* buil*
chmod -R 755 ./*
chown www-data:www-data -R ./*

4、配置Caddy

#以下全部内容是一个整体,是一个命令,修改示例域名后全部复制粘贴到SSH软件中并一起执行
echo "http://moerats.com {
    redir https://www.moerats.com{uri}
    }
    https://www.moerats.com {
    gzip
    tls admin@moerats.com
    root /typecho
    fastcgi / /run/php/php7.0-fpm.sock php
    rewrite {
        if {path} not_match ^\/admin
        to {path} {path}/ /index.php?{query}
     }
}" > /usr/local/caddy/Caddyfile

参数说明:

#第一个{}参数为重定向,将http://moerats.com重定向到了https://www.moerats.com,根据实际情况修改
#tls为自动签发Let's证书,邮箱随便填,使用自签发证书的请先解析好域名,如果想使用自己的证书,则将tls一行改成tls
/root/xxx.crt /root/xxx.key即可,后面为证书路径。

最后启动Caddy

#如果启动失败,请查看下系统是否自带Apache2,然后运行apt remove apache2卸载掉
/etc/init.d/caddy start

然后可以访问域名进行安装了。
请输入图片描述

数据库文件在/typecho/usr文件夹,记得随时备份。

Caddy说明

启动:/etc/init.d/caddy start
停止:/etc/init.d/caddy stop
重启:/etc/init.d/caddy restart
查看状态:/etc/init.d/caddy status
查看Caddy启动日志:tail -f /tmp/caddy.log
安装目录:/usr/local/caddy
Caddy配置文件位置:/usr/local/caddy/Caddyfile
Caddy自动申请SSL证书位置:/.caddy/acme/acme-v01.api.letsencrypt.org/sites/xxx.xxx(域名)/

版权声明:本文为原创文章,版权归 Rat's Blog 所有,转载请注明出处!

本文链接:https://www.moerats.com/archives/651/

如教程需要更新,或者相关链接出现404,可以在文章下面评论留言。