Nginx(v1.18.0) 安装下载rpm -ivh http://nginx.org/packages/centos/7/x86_64/RPMS/nginx-1.18.0-1.el7.ngx.x86_64.rpm相关命令# 启动 systemctl start nginx # 查看状态 systemctl status nginx # 开机自启 systemctl enable nginxMySQL(v5.7) 安装下载安装wget http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm && yum -y install mysql57-community-release-el7-10.noarch.rpm && yum -y install mysql-community-server # 若报错 GPG 验证不通过，使用下面命令安装 yum install mysql-community-server --nogpgcheck如果下载太慢，手动到镜像网站下载相关文件，放到 /var/cache/yum/x86_64/7/mysql57-community/packages 目录即可中科大镜像站网易镜像站报错 GPG 验证不通过也可参考此文章：yum 安装软件出现 gpg keys 相关问题相关命令# 启动 systemctl start mysql # 查看初始密码 grep "password" /var/log/mysqld.log # 登录 msyql -uroot -p修改密码(登录后)# 安全策略 set global validate_password_policy=0; # 长度校验 set global validate_password_length=4; # 修改 roor 初始密码 ALTER USER 'root'@'localhost' IDENTIFIED BY 'root'; # 授权 root 用户远程管理权限 GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root';MySQL 卸载教程使用 rpm -qa | grep -i mysql 查看是否装有 MySQLrpm -ev xxx 删除 MySQL如果提示依赖包错误，则使用以下命令尝试 rpm -ev xxx --nodeps如果提示错误：error: %preun(xxxxxx) scriptlet failed, exit status 1，则用以下命令尝试：rpm -e --noscripts xxxx查找之前老版本 MySQL 的目录、并且删除老版本 MySQL 的文件和库：find / -name mysql删除对应的 mysql 目录注意： 卸载后/etc/my.cnf不会删除，需要进行手工删除：rm -rf /etc/my.cnf再次查找机器是否安装mysql：rpm -qa | grep -i mysqlPHP(v7.3) 安装安装 EPEL(Extra Packages for Enterprise Linux)源yum install epel-release安装 WEBTATIC 源rpm -ivh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm安装 PHP 及其扩展yum install php71w php71w-fpm \ php71w-cli php71w-common php71w-devel php71w-gd \ php71w-pdo php71w-mysql php71w-mbstring php71w-bcmath \ php71w-pecl-redis相关命令# 启动 systemctl start php-fpm # 查看状态 systemctl status php-fpm # 开机自启 systemctl enable php-fpmTypecho# 创建网站目录 mkdir -p /var/www/iruochen.net # 下载 typecho cd /var/www/iruochen.net wget http://typecho.org/downloads/1.1-17.10.30-release.tar.gz # 解压 tar -xzvf 1.1-17.10.30-release.tar.gz # 解压后移至根目录 mv /var/www/iruochen.net/build/* /var/www/iruochen.net # 删除多余文件 rmdir build && rm 1.1-17.10.30-release.tar.gzNginx 配置cd /etc/nginx/conf.d vim iruochen.net.confserver { listen 80; server_name iruochen.net; // 代理域名 location / { root /var/www/iruochen.net; // 网站根目录 index index.html index.htm index.php; // 伪静态 if (-f $request_filename/index.html){ rewrite (.*) $1/index.html break; } if (-f $request_filename/index.php){ rewrite (.*) $1/index.php; } if (!-f $request_filename){ rewrite (.*) /index.php; } } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/iruochen.net$fastcgi_script_name; include fastcgi_params; } }重启 nginxsystemctl restart nginx创建 typecho 数据库mysql -uroot -p create database typecho; exit;