欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 房产 > 建筑 > 在Ubuntu子系统中基于Nginx部署Typecho

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

2025/2/5 18:39:58 来源:https://blog.csdn.net/FG24151110876/article/details/145405245  浏览:    关键词:在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
  1. 启动php8.1-fpm
sudo service php8.1-fpm start
sudo service php8.1-fpm status
  1. 添加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;}
}
  1. 将配置文件链接到/etc/nginx/sites-enabled/目录
    命令如下:
    sudo ln -s /etc/nginx/sites-available/typecho.conf /etc/nginx/sites-enabled/
  2. 检查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
  1. 在浏览器中访问你的服务器IP
    http://127.0.0.1/install.php
    开始 Typecho 的安装向导,按照提示填写数据库信息等,完成 Typecho 的安装

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com