栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > PHP

安装typecho

PHP 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

安装typecho

操作系统版本介绍

更新apt-get
apt-get update
安装mysql
apt-get --purge remove mysql-server mysql-common mysql-client #卸载以前的依赖
apt-get install mysql-server mysql-common mysql-client # 安装
设置密码

使用这个方法安装的mysql是没有密码的,即输入mysql -u root -p就可以回车直接登录。所以需要人为设置密码。

root@ilocalhost:~# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 2
Server version: 5.7.27-0ubuntu0.18.04.1 (Ubuntu)

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> update user set authentication_string=PASSWORD("yourpassword") where user='root';
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 1

mysql> update user set plugin="mysql_native_password";
Query OK, 1 row affected (0.00 sec)
Rows matched: 4  Changed: 1  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> quit;
Bye

重启mysql

service  mysql  restart
设置编码 安装中文语言包

这里我们会遇到一个坑,就是在后面程序启动保存数据的时候会出现中文乱码,但是我们明明已经编辑过默认编码了呀。这里我发现是阿里云服务器本身没有安装中文包,我们需要进行安装。

安装中文语言包
sudo apt-get -y install language-pack-zh-hans
修改语言环境设置
echo "LC_ALL=zh_CN.utf8" >> /etc/profile
echo "export LC_ALL" >> /etc/profile
查看语言
source /etc/profile

locale
看到zh_CN.UTF-8就成功了。接着需要重启服务器。

安装nginx
apt-get install nginx
安装php
apt-get install php-fpm 

安装成功后,会自动运行php-fpm,php-fpm默认使用的unix socket,修改配置文件,配置文件路径在/etc/php/7.2/fpm/pool.d/www.conf。(注意,我这里安装的是7.2你们可能并不一样)

 service php7.2-fpm restart
使用nginx 查看php是否安装成功

写一个index.php

vi /var/www/html/index.php

输入以下内容


vi /etc/nginx/sites-enabled/php.conf

输入以下内容

server {
       listen 80;
       listen [::]:80;

       server_name xx.xx.xx.xx;

       root /var/www/html;
       index index.html;

    location ~ .php$ {
             root /home/typecho; #指定php的根目录
             fastcgi_pass 127.0.0.1:9000;#php-fpm的默认端口是9000
             fastcgi_index index.php;
             fastcgi_param script_FILENAME $document_root$fastcgi_script_name;
             include fastcgi_params;
    }
}

重启nginx

 service nginx restart


说明安装成功

安装其他组件
 apt-get install -y php-mysql php-gd  php-ldap php-odbc php-pear  php-xml  php-xmlrpc php-mbstring php-snmp php-soap curl 

现在平台已经搭建好了,进行typecho的安装

安装typecho
  1. 下载typecho
  2. 将typecho解压后放在/home/typecho
  3. 设置typecho文件夹权限
  4. 重启nginx
  5. 访问浏览器
  6. 安装完成
推荐插件

推荐主题

效果:奇葩秋

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/268658.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号