在Ubuntu子系统中基于Nginx部署Typecho

  1. 下载部署程序
    typecho
  2. 上传文件到子系统
  • 创建文件夹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

  1. 使用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

  2. 启动php8.1-fpm

    sudo service php8.1-fpm start
    sudo service php8.1-fpm status

  3. 添加nginx配置文件
    /etc/nginx/sites-available目录中创建一个typecho.conf的配置文件
    命令如下
    vim /etc/nginx/sites-available/typecho.conf
    在文件中输入以下内容

    server {
    listen 80;
    server_name 127.0.0.1; # 将这里替换为你的域名或服务器IP

    复制代码
     root /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;
     }

    }

  4. 将配置文件链接到/etc/nginx/sites-enabled/目录
    命令如下:
    sudo ln -s /etc/nginx/sites-available/typecho.conf /etc/nginx/sites-enabled/

  5. 检查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

  6. 在浏览器中访问你的服务器IP
    http://127.0.0.1/install.php
    开始 Typecho 的安装向导,按照提示填写数据库信息等,完成 Typecho 的安装

相关推荐
tntxia3 小时前
linux curl命令详解_curl详解
linux
扛枪的书生6 小时前
Linux 网络管理器用法速查
linux
顺风尿一寸8 小时前
Java Socket 内核之旅:从 SocketChannel.read() 到 tcp_recvmsg 与 epoll 的完整调用链路
linux
XIAOHEZIcode15 小时前
Ubuntu 终端美化全栈指南:Bash 到 Kitty 踩坑实录
linux·ubuntu·命令行
唐青枫17 小时前
别再只会用 cron:Linux systemd Timer 定时任务实战详解
linux
AlfredZhao3 天前
生产环境里,为什么不建议把普通端口直接暴露到公网?
linux·https·443·80
戴为沐4 天前
Linux内存扩容指南
linux
zylyehuo4 天前
Linux 彻底且安全地删除文件
linux
用户805533698035 天前
主线 U-Boot 上 RK3506:和闭源 rkbin 拔河的三个隐性契约
linux·嵌入式
用户034095297915 天前
linux fcitx 5 雾凇拼音 设置在中文输入法下仍然输入英文标点
linux