Typecho简单快速搭建个人blog
环境准备
服务器:腾讯云lighthouse,1c1g
镜像:CentOS7.6
用户:root
安装NMP(Nginx+Mysql+Php)
均采用yum方式安装
Php
yum install -y php php-devel php-fpm php-gd php-mbstring php-mysql
创建php配置文件
cp /etc/php-fpm.d/www.conf /etc/php-fpm.d/typecho.conf
修改typecho.conf文件内容
user = apache -> user = nginx
group = apache -> group = nginx
;chdir = /var/www -> chdir = /data/typecho
创建typecho文件目录
mkdir -p /data/typecho
启动php服务与开机自启
systemctl start php-fpm.service
systemctl enable php-fpm.service
Nginx
yum install -y nginx
systemctl enable nginx #开机自启动nginx
systemctl start nginx #启动nginx
创建nginx配置文件
vim /etc/nginx/conf.d/typecho.conf
中括号[]中的内容替换为二级域名和顶级域名
server{
listen 80;
server_name [subdomain].[topdomian].com;
error_log /data/log/nginx/[subdomain].[topdomian].com.error.log;
location / {
root /data/typecho;
index index.php index.html index.htm;
}
location ~ .*\.php(\/.*)*$ {
root /data/typecho;
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
fastcgi_split_path_info ^(.+?.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
}
mkdir -p /data/log/nginx #创建nginx日志文件目录
nginx -t #测试nginx配置文件是否正确
nginx -s reload #加载nginx配置文件
Mariadb
yum install -y mariadb mariadb-server
systemctl enable mariadb
systemctl start mariadb
创建数据库与用户
中括号[]中的内容替换为数据库用户与密码
create database typecho;
grant all privileges on typecho.* to '[yourdbuser]'@'localhost' identified by '[yourpassword]';
Typecho
下载解压
wget -P /data http://typecho.org/downloads/1.1-17.10.30-release.tar.gz #下载
tar -zxvf /data/1.1-17.10.30-release.tar.gz -C /data #解压
mv /data/build/* /data/typecho #文件移动到指定目录
chown nginx:nginx /data/typecho -Rf #修改文件权限
Comments | NOTHING