- 下载部署程序
typecho - 上传文件到子系统
-
创建文件夹
typecho
在目录/var/www/html
中创建一个目录typecho
cd /var/www/html
mkdir typecho -
将文件
typecho.zip
上传至新建的目录下,并解压文件unzip typecho.zip
-
授权文件夹
sudo chown -R www-data:www-data /var/www/html
sudo chmod -R 755 /var/www/html
-
使用apt 安装
php
以及nginx
。apt install nginx
sudo apt install php-fpm php-mysql php-curl php-gd php-intl php-mbstring php-xmlrpc php-zip -
启动
php8.1-fpm
sudo service php8.1-fpm start
sudo service php8.1-fpm status -
添加
nginx
配置文件
在/etc/nginx/sites-available
目录中创建一个typecho.conf
的配置文件
命令如下
vim /etc/nginx/sites-available/typecho.conf
在文件中输入以下内容server {
listen 80;
server_name 127.0.0.1; # 将这里替换为你的域名或服务器IProot /var/www/html/typecho; # Typecho安装目录 location / { try_files $uri $uri/ /index.php?$args; index index.php index.html index.htm; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php8.1-fpm.sock; # 根据你的PHP版本修改 } location ~ /\.ht { deny all; }
}
-
将配置文件链接到
/etc/nginx/sites-enabled/
目录
命令如下:
sudo ln -s /etc/nginx/sites-available/typecho.conf /etc/nginx/sites-enabled/
-
检查Nginx并重启
nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
sudo service nginx restart -
在浏览器中访问你的服务器IP
http://127.0.0.1/install.php
开始 Typecho 的安装向导,按照提示填写数据库信息等,完成 Typecho 的安装