Typecho 代码精简、资源占用很低,1 核 1G 的 VPS 也能轻松运行,适合个人博客。
环境
需要 Nginx + PHP + MySQL/MariaDB(也支持 SQLite),搭建方法见 Ubuntu 搭建 LNMP 环境。
PHP 扩展:
apt install php-fpm php-mysql php-mbstring php-curl php-xml -y
1. 下载
从 Typecho 官网下载最新正式版,解压到网站目录:
mkdir -p /var/www/blog.example.com
# 把下载的程序包解压到上面的目录
chown -R www-data:www-data /var/www/blog.example.com
2. 创建数据库
CREATE DATABASE typecho DEFAULT CHARACTER SET utf8mb4;
CREATE USER 'typecho'@'localhost' IDENTIFIED BY '强密码';
GRANT ALL PRIVILEGES ON typecho.* TO 'typecho'@'localhost';
3. Nginx 配置(含伪静态)
server {
listen 80;
server_name blog.example.com;
root /var/www/blog.example.com;
index index.php;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php(/|$) {
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass unix:/run/php/php8.3-fpm.sock; # 版本号按实际
}
location ~ /\. {
deny all;
}
}
nginx -t && systemctl reload nginx
4. 安装向导
访问域名,按向导填写数据库信息、管理员账户。安装完成后,在后台「设置 → 永久链接」中开启地址重写。
5. 安全
- 安装完成后确认安装文件已按提示处理
- 后台使用强密码
- 申请 HTTPS 证书:Certbot 免费证书
6. 备份
数据库 + usr/ 目录(主题、插件、上传的文件)。
想要更多功能
需要丰富的插件生态和可视化编辑,可以选择 WordPress,见 在 LNMP 上安装 WordPress。
还拿不准选哪款?
把业务类型、访问人群和预算告诉我们,工程师 7×24 在线,工单平均 10 分钟内响应。
