Ubuntu安装typecho博客

简介

名称的来历

Typecho 是由 type 和 echo 两个词合成的,来自于开发团队的头脑风暴。

Type,有打字的意思,博客这个东西,正是一个让我们通过打字,在网络上表达自己的平台。Echo,意思是回声、反馈、共鸣,也是PHP里最常见、最重要的函数,相信大部分PHP爱好者都是从 echo 'Hello,world!'; 开始自己的PHP编程之路的。

Typecho 是国内开发者开发的一款开源免费的动态博客程序,可以运行在基于 PHP 环境的各种平台上。

相比于同为动态博客并且广为人知的 WordPress 来说,Typecho 的一大特点就是 “精简”。全部文件不足 500KB,但却也实现了完整的主题和插件支持。博客程序很轻量,资源占用也很低,原生支持 Markdown 语法。属于省心并且简洁的博客类型。

安装所需环境

# 安装PHP所需插件
# 添加ppa源
add-apt-repository ppa:ondrej/php
apt install nginx php7.4 php7.4-mysql php7.4-fpm

下载安装主程序

# 进入网站所在目录
root@cby:~# cd /var/www/html/
root@cby:/var/www/html# ls
index.nginx-debian.html index.php php.php
root@cby:/var/www/html# ll
total 20
drwxr-xr-x 2 root root 4096 Dec 6 16:29 ./
drwxr-xr-x 3 root root 4096 Dec 6 16:01 ../
-rw-r--r-- 1 root root 612 Dec 6 16:01 index.nginx-debian.html
-rw-r--r-- 1 root root 20 Dec 6 16:29 php.php
root@cby:/var/www/html# # 下载安装包
root@cby:/var/www/html# wget https://mirrors.chenby.cn/https://github.com/typecho/typecho/releases/latest/download/typecho.zip
--2023-12-06 16:35:48-- https://mirrors.chenby.cn/https://github.com/typecho/typecho/releases/latest/download/typecho.zip
Resolving mirrors.chenby.cn (mirrors.chenby.cn)... 172.67.134.246, 104.21.25.253, 2606:4700:3032::ac43:86f6, ...
Connecting to mirrors.chenby.cn (mirrors.chenby.cn)|172.67.134.246|:443... connected.
HTTP request sent, awaiting response... 302 Found
Cookie coming from mirrors.chenby.cn attempted to set domain to github.com
Cookie coming from mirrors.chenby.cn attempted to set domain to github.com
Location: /https://github.com/typecho/typecho/releases/download/v1.2.1/typecho.zip [following]
--2023-12-06 16:35:49-- https://mirrors.chenby.cn/https://github.com/typecho/typecho/releases/download/v1.2.1/typecho.zip
Reusing existing connection to mirrors.chenby.cn:443.
HTTP request sent, awaiting response... 200 OK
Length: 610472 (596K) [application/octet-stream]
Saving to: ‘typecho.zip’ typecho.zip 100%[=======================================================================>] 596.16K 935KB/s in 0.6s 2023-12-06 16:35:50 (935 KB/s) - ‘typecho.zip’ saved [610472/610472] # 解压安装包
root@cby:/var/www/html# unzip typecho.zip
Archive: typecho.zip
inflating: LICENSE.txt
creating: admin/
inflating: admin/editor-js.php
inflating: admin/table-js.php
inflating: admin/options-general.php
******略******
inflating: var/Widget/Contents/Page/Rows.php
inflating: var/Widget/Contents/Page/Admin.php
inflating: var/Widget/Contents/Page/Edit.php
inflating: var/Widget/XmlRpc.php
root@cby:/var/www/html#
root@cby:/var/www/html#
root@cby:/var/www/html# # 添加权限
root@cby:/var/www/html# chmod 777 * -R

修改配置

# 修改NGINX配置
vim /etc/nginx/nginx.conf
#添加路由信息
--------------- 略 ---------------
if (-f $request_filename/index.html) {
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php) {
rewrite (.*) $1/index.php;
}
if (!-f $request_filename) {
rewrite (.*) /index.php;
} location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_intercept_errors on;
}
--------------- 略 ---------------

重启服务

# 设置开机自启
root@cby:~# systemctl enable nginx
Synchronizing state of nginx.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable nginx
# 重启NGINX
root@cby:~# systemctl restart nginx
# 查看状态
root@cby:~# systemctl status nginx
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2023-12-08 10:09:31 CST; 42s ago
Docs: man:nginx(8)
Process: 632604 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Process: 632605 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Main PID: 632606 (nginx)
Tasks: 5 (limit: 3943)
Memory: 112.5M
CPU: 108ms
CGroup: /system.slice/nginx.service
├─632606 "nginx: master process /usr/sbin/nginx -g daemon on; master_process on;"
├─632607 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
├─632608 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
├─632609 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
└─632610 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" Dec 08 10:09:31 cby systemd[1]: Starting A high performance web server and a reverse proxy server...
Dec 08 10:09:31 cby systemd[1]: Started A high performance web server and a reverse proxy server.
root@cby:~# # 设置开机自启
root@cby:~# systemctl enable php7.4-fpm
Synchronizing state of php7.4-fpm.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable php7.4-fpm
# 重启PHP-FPM
root@cby:~# systemctl restart php7.4-fpm
# 查看状态
root@cby:~# systemctl status php7.4-fpm.service
● php7.4-fpm.service - The PHP 7.4 FastCGI Process Manager
Loaded: loaded (/lib/systemd/system/php7.4-fpm.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2023-12-08 10:11:02 CST; 2s ago
Docs: man:php-fpm7.4(8)
Process: 633187 ExecStartPost=/usr/lib/php/php-fpm-socket-helper install /run/php/php-fpm.sock /etc/php/7.4/fpm/pool.d/www.conf 74 (code=exited, status=0/SUCCESS)
Main PID: 633184 (php-fpm7.4)
Status: "Ready to handle connections"
Tasks: 3 (limit: 3943)
Memory: 11.0M
CPU: 64ms
CGroup: /system.slice/php7.4-fpm.service
├─633184 "php-fpm: master process (/etc/php/7.4/fpm/php-fpm.conf)" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
├─633185 "php-fpm: pool www" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" >
└─633186 "php-fpm: pool www" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" > Dec 08 10:11:02 cby systemd[1]: Starting The PHP 7.4 FastCGI Process Manager...
Dec 08 10:11:02 cby systemd[1]: Started The PHP 7.4 FastCGI Process Manager.
root@cby:~#

我的NGINX配置文件

# NGINX配置文件
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf; events {
worker_connections 768;
} http { sendfile on;
tcp_nopush on;
types_hash_max_size 2048; include /etc/nginx/mime.types;
default_type application/octet-stream; ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on; access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log; gzip on; log_format main '{ "@timestamp": "$time_local", '
'"remote_addr": "$remote_addr",'
'"remote_port": "$remote_port",'
'"scheme": "$scheme",'
'"request_uri": "$request_uri",'
'"request_method": "$request_method",'
'"request_time": "$request_time",'
'"request_length": "$request_length",'
'"response_status": "$status",'
'"body_bytes_sent": "$body_bytes_sent",'
'"http_referer": "$http_referer",'
'"http_user_agent": "$http_user_agent",'
'"http_x_forwarded_for": "$http_x_forwarded_for",'
'"upstream_addr": "$upstream_addr",'
'"upstream_response_time": "$upstream_response_time",'
'"request_body": "$request_body"}'; server {
listen 80 default_server;
listen [::]:80 default_server; listen 443 ssl http2;
listen [::]:443 ssl http2; ssl_certificate /ssl/cert.pem;
ssl_certificate_key /ssl/cert.key;
ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ecdh_curve X25519:prime256v1:secp384r1:secp521r1;
ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256;
ssl_prefer_server_ciphers on;
ssl_session_timeout 10m;
ssl_session_cache shared:SSL:10m;
ssl_buffer_size 2k;
add_header Strict-Transport-Security max-age=15768000;
ssl_stapling on;
ssl_stapling_verify on; error_log /var/logs/nginx-error.log info;
access_log /var/logs/nginx-access.log main; root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html; server_name _; location / {
try_files $uri $uri/ =404;
} if (-f $request_filename/index.html) {
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php) {
rewrite (.*) $1/index.php;
}
if (!-f $request_filename) {
rewrite (.*) /index.php;
} location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_intercept_errors on;
}
}
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}

关于

https://www.oiox.cn/

https://www.oiox.cn/index.php/start-page.html

CSDN、GitHub、51CTO、知乎、开源中国、思否、博客园、掘金、简书、华为云、阿里云、腾讯云、哔哩哔哩、今日头条、新浪微博、个人博客

全网可搜《小陈运维》

文章主要发布于微信公众号

Ubuntu安装typecho博客的更多相关文章

  1. ubuntu安装hexo博客

    ubuntu下安装hexo博客 一 安装git sudo apt-get install git 二 安装nodejs 官网下载linux安装包.tar.gz文件 解压 tar zxvf 这样变可以切 ...

  2. 使用LNMP环境安装typecho博客的全程记录

    虽然我是搞asp.net的 但是十分欣赏php,php有很多开源的博客程序 比如大名鼎鼎的Wordpress.还有各种独立博客大牛使用的z-blog,以及短小精悍的emblog. wordpress臃 ...

  3. 部署lnmp环境,安装typecho博客

    安装nginx和PHP环境 root@cby:~# apt install nginx php7.4 php7.4-mysql php7.4-fpm 修改nginx配置文件 root@cby:~# v ...

  4. Typecho博客支持emoji表情设置

    介绍 大家在typecho博客写文章时,很多人都喜欢使用emoji表情(比如这些图标)但是typecho的数据库类型默认不支持emoji编码,因为Emoji是一种在Unicode位于u1F601-u1 ...

  5. Typecho博客转移服务器,数据备份.

    目录 Typecho博客转移服务器,数据备份. 简述操作(有基础的mjj看这个简述就可以了.) 详细步骤(建议小白来看, 已经在很多详细方面进行说明了.) 备份篇 备份导入与数据库转移篇 重新部署ty ...

  6. 使用“宝塔一键迁移”工具,将typecho博客迁移到京东云cvm云主机

    作者:京东科技 林中 服务器更换.网站搬家,对于很多开发者新手来说不是一件容易的事情,需要迁移网站程序.数据库,修改数据库连接文件等.在云迁移方案中,宝塔是非常简单好用的服务器运维面板,能够极大提升运 ...

  7. Typecho博客迁移

    在新的机器上先搭建好一个新的Typecho博客,数据库名称和原博客相同(可以省不少事). 备份原来博客的usr目录. 备份mysql数据库,命令: mysqldump -uroot -p --all- ...

  8. LNMP环境搭建之php安装,wordpress博客搭建

    LNMP环境搭建之php安装,wordpress博客搭建 一.介绍: 1.什么是CGI CGI全称是"通用网关接口"(Common Gateway Interface),HTTP服 ...

  9. Typecho博客添加版权说明

    版权声明是指作品权利人对自己创作作品的权利的一种口头或书面声明,一般版权声明应该包括权利归属.作品使用准许方式.责任追究等方面的内容.诸如平时看文章时最后会有一个严禁转载的说明,其实这就是版权声明. ...

  10. Docker——基于Docker安装Drupal博客系统

    Docker--基于Docker安装Drupal博客系统 向脚本文件追加内容 cat << EOF > build.sh #设置主机名 hostnamectl set-hostnam ...

随机推荐

  1. python代码打包exe程序

    1.安装pyinstaller 命令行输入:pip install pyinstaller 2.打包exe程序 输入命令:pyinstaller -F -w *.py(星号是.py的全部路径) pyi ...

  2. CoinBase是什么?

    什么是CoinBase交易? 比特币区块链上的每个区块中都会包含一个或者多个交易(transaction),其中第一个交易就叫做CoinBase交易. 什么是CoinBase交易? CoinBase交 ...

  3. 配置Maven项目时无法找到依赖

    1.问题 在配置pom.xml文件时,关于plugin插件配置时,遭遇许多类似 未找到插件 'maven-clean-plugin:3.1.0' 未找到插件 'org.apache.maven.plu ...

  4. css - 隐藏body滚动条

    body::-webkit-scrollbar{ display: none; }

  5. win11不改时区,安装 android 子系统,运行android app

    win11开启虚拟机平台 下载安卓子系统 打开https://store.rg-adguard.net , 在URL中输入:https://www.microsoft.com/store/produc ...

  6. Kafka 社区KIP-382中文译文(MirrorMaker2/集群复制/高可用/灾难恢复)

    译者:对于Kafka高可用的课题,我想每个公司都有自己的方案及思考,这是一个仁者见仁智者见智的命题,而社区给出了一个较大的特性,即MirrorMaker 2.0,不论是准备做高可用还是单纯的数据备份, ...

  7. 百度网盘(百度云)SVIP超级会员共享账号每日更新(2024.01.03)

    一.百度网盘SVIP超级会员共享账号 可能很多人不懂这个共享账号是什么意思,小编在这里给大家做一下解答. 我们多知道百度网盘很大的用处就是类似U盘,不同的人把文件上传到百度网盘,别人可以直接下载,避免 ...

  8. [转帖]AES算法(四)基本工作模式

    https://zhuanlan.zhihu.com/p/376077687 8 人赞同了该文章 本文所述工作模式可适用于 DES.AES 等分组密码算法中 分组密码算法只能加密固定长度为 N 比特的 ...

  9. [转帖]【终端使用】"usermod"命令 和 组(包括:主组、附加组)

      "usermod"命令,可以用来设置用户账户的 主组.附加组.登录使用的Shell. 命令 作用 usermod -g 组名 用户名 修改用户的主组(gid) usermod ...

  10. [转帖]decimal,float和double的区别是什么?

    https://zhuanlan.zhihu.com/p/352503879 今天复习mysql理论知识,在看常用数据类型的时候发现float和decimal类型都是表示小数,就展开搜索学习了一下区别 ...