在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 的安装

相关推荐
你好,赵志伟1 小时前
Socket 编程 TCP
linux·服务器·tcp/ip
Liang_GaRy2 小时前
心路历程-三个了解敲开linux的大门
linux·运维·服务器
一只栖枝6 小时前
华为 HCIE 大数据认证中 Linux 命令行的运用及价值
大数据·linux·运维·华为·华为认证·hcie·it
wuicer8 小时前
ubuntu 20.04 安装anaconda以及安装spyder
linux·运维·ubuntu
cui__OaO10 小时前
Linux软件编程--线程
linux·开发语言·线程·互斥锁·死锁·信号量·嵌入式学习
小狗爱吃黄桃罐头10 小时前
正点原子【第四期】Linux之驱动开发篇学习笔记-1.1 Linux驱动开发与裸机开发的区别
linux·驱动开发·学习
小晶晶京京10 小时前
day34-LNMP详解
linux·运维·服务器
画个太阳作晴天10 小时前
A12预装app
linux·服务器·前端
fengyehongWorld11 小时前
Linux crontab定时任务
linux·运维
shuangrenlong11 小时前
ubuntu更新chrome版本
linux·chrome·ubuntu