博主

6分钟前在线

初音萌 💫 随笔
歌曲封面 未知作品
  • 歌曲封面クリームソーダとシャンデリアEdo_Ame江户糖
  • 歌曲封面ちるちるREOL
  • 歌曲封面心跳23事小野道ono

鄂ICP备2023028426号

MIKU ☁️ MOE © 2025

本网站由提供CDN加速/云存储服务

网站已运行 117 天 17 小时 46 分

Powered by Typecho & Sunny

2 online · 22 ms

Title

Typecho博客部署

miku_moe

·

技术

·

Article

由于当前服务器宽带较低,目前正在考虑博客迁移,顺便完整记录新服务配置流程。

本文出现的所有指令均基于Debian系统,本文操作指令仅做参考。

同时会尽量标注官方指令地址(如有)。

  1. 云服务器 重装系统 >> Debian12
  2. 更新

    ♾️ sh 代码:
    sudo apt update
    sudo apt upgrade
  3. 安装Docker
    优先使用官方文档推荐的命令:官方文档地址

    ♾️ sh 代码:
    # 配置
    sudo apt-get install ca-certificates curl
    sudo install -m 0755 -d /etc/apt/keyrings
    sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
    sudo chmod a+r /etc/apt/keyrings/docker.asc
    
    echo \
      "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
      $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
      sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
    # 更新软件包配置
    sudo apt-get update
    # 执行安装
    sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
    # 验证指令
    docker images
    docker ps
  4. 安装Nginx

    ♾️ sh 代码:
    sudo apt install nginx
    # 验证
    systemctl status nginx
  5. 安装Php

    ♾️ sh 代码:
    sudo apt install php
    # 安装PHP-FPM(版本与PHP保持一致)
    sudo apt install php8.2-fpm
    # 验证
    php -v
  6. 安装Mysql

    ♾️ sh 代码:
    # 前往官网获取最新软件包连接:https://dev.mysql.com/downloads/repo/apt/
    wget https://dev.mysql.com/get/mysql-apt-config_0.8.33-1_all.deb
    sudo apt install gnupg -y
    sudo dpkg -i mysql-apt-config_0.8.33-1_all.deb
    # 更新配置包
    sudo apt update
    # 安装
    sudo apt install mysql-server
    # 验证
    sudo systemctl status mysql
    # 修改访问权限
    sudo mysql -uroot -p 
    use mysql;
    update user set Host = '%' where User = 'root';
    FLUSH PRIVILEGES;
    exit;

    使用容器安装

    ♾️ sh 代码:
    # 略...
  7. 配置Typecho

    ♾️ sh 代码:
    # 官网下载文件并上传到服务(作者地址为/www/html/ty/...):https://typecho.org/download
    sudo apt install unzip
    unzip typecho.zip
    # 修改权限
    sudo chmod -R 777 /www/html/ty/usr/
    ## 安装相关扩展
    sudo apt install php-mbstring
    sudo apt install php-mysql
    # 安装完成后请重启
    sudo systemctl restart php8.2-fpm
  8. 配置Nginx

    ♾️ sh 代码:
    nano /etc/nginx/conf.d/main.conf
    # 新增配置文件并写入
    server {
     listen 80;
     server_name 域名或者IP;
    
     root /www/html/ty; # 博客解压地址
     index index.php index.html index.htm;
    
     location / {
         try_files $uri $uri/ /index.php?$query_string;
     }
    
     location ~ \.php$ {
         include snippets/fastcgi-php.conf;
         fastcgi_pass unix:/var/run/php/php8.2-fpm.sock; # 替换为自己的版本
         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
         include fastcgi_params;
     }
    }
    systemctl restart nginx
    
现在已有 51 次阅读,0 条评论,0 人点赞
Comment:共0条
发表
搜 索 消 息 足 迹
你还不曾留言过..
你还不曾留下足迹..
博主 不再显示
博主