- 代理服务器用nginx,数据库用sqlite3,以及Typecho需要的PHP及其拓展
sudo apt update && sudo apt upgrade -y
sudo apt install nginx
sudo apt install sqlite3
sudo apt install php-fpm php-curl php-gd php-mbstring php-xml php-sqlite3
- 修改nginx配置,修改 /etc/nginx/sites-enabled/default这个文件
server {
listen 80 default_server;
listen [::]:80 default_server;
#有域名可填,默认接受所有来源,可直接IP访问
server_name _;
root /var/www/html;
#注意一定要带上index.php
index index.php index.html index.htm index.nginx-debian.html;
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php$1 last;
}
location / {
try_files $uri $uri/ =404;
}
location ~ .*\.php(\/.*)*$ {
include snippets/fastcgi-php.conf;
set $path_info "";
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
set $real_script_name $1;
set $path_info $2;
}
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_param SCRIPT_NAME $real_script_name;
fastcgi_param PATH_INFO $path_info;
}
}
- 下载解压最新的Typecho,并设置相关文件的访问权限
sudo apt install unzip
cd var/www/html
sudo wget https://github.com/typecho/typecho/releases/latest/download/typecho.zip
unzip typecho.zip && rm typecho.zip
chmod -R 777 ../html
-
用IP直接访问,跟着Typecho安装指引完成设置
-
部署完成
教程参考https://zhuanlan.zhihu.com/p/16354479724
评论 (0)