Typecho 1.2.0 部署

Typecho 1.2.0 部署

Acha
2022-09-08 / 0 评论 / 620 阅读 / 正在检测是否收录...
温馨提示:
本文最后更新于2022年09月08日,已超过817天没有更新,若内容或图片失效,请留言反馈。

Typecho 1.2.0 部署

环境

  • CentOS7.9

  • Nginx/1.20.1

  • PHP 7.2.34

  • mysql-5.7.37

初始化系统

curl -O file.youto.club/Script/init.sh
sh init.sh blog
[root@blog nginx]# cat /script/init.sh 
#!/usr/bin/bash
echo "=-=-=- Action -=-=-="
hostnamectl set-hostname $1
echo "# ==> Hostname: " `hostname`

systemctl stop firewalld && systemctl disable firewalld >/dev/null 2>&1
setenforce 0 >/dev/null 2>&1
sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
echo "# ==> Stop Firewalld && Selinux"

mkdir /etc/yum.repos.d/bak -p
mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak

curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo >/dev/null 2>&1
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo >/dev/null 2>&1

yum repolist  | grep repolist


echo "# ==>repo"
yum install -y lrzsz tree wget vim net-tools unzip bash-completion git >/dev/null 2>&1

sed -i "s/\#UseDNS no/UseDNS yes/g" /etc/ssh/sshd_config
echo "# ==> SSH "

echo "=-=-=- Done -=-=-="

准备软件包

  • mysql-5.7.37-1.el7.x86_64.rpm.tar

  • nginx-1.20.1.tar.gz

  • typecho.zip

mkdir /{repo,software,script}
# MySQl
wget http://file.youto.club/Repo/mysql-5.7.37-1.el7.x86_64.rpm.tar
tar xf mysql-5.7.37-1.el7.x86_64.rpm.tar -c /repo
ls /repo/mysql57_2009_repo/
vim /etc/yum.repos.d/mysql_local.repo
yum repolist

# PHP72
yum install -y http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum install -y yum-utils
yum-config-manager --enable remi-php72

# typecho
wget https://github.com/typecho/typecho/releases/latest/download/typecho.zip
mv typecho.zip /software/
[root@blog nginx]# cat /etc/yum.repos.d/mysql_local.repo 
[mysql57]
name=mysql57
baseurl=file:///repo/mysql57_2009_repo/
gpgcheck=0
enabled=1

MySQL

yum install -y mysql-server
systemctl enable mysqld
systemctl start mysqld
grep pass /var/log/mysqld.log 
mysql -uroot -p
[root@blog nginx]# mysql -uroot -p

mysql> alter user user() identified by 'Admin@123';
Query OK, 0 rows affected (0.00 sec)

mysql> create database typecho;
Query OK, 1 row affected (0.00 sec)

mysql> GRANT ALL ON typecho.* TO 'typecho'@'localhost' IDENTIFIED BY 'Abc@1234';
Query OK, 0 rows affected, 1 warning (0.00 sec)

PHP

yum install -y php72 
php72 -v
yum install -y php72-php-fpm php72-php-mbstring php72-php-mysqlnd 
systemctl enable php72-php-fpm.service
systemctl start php72-php-fpm.service
netstat -lntp

rpm -ql php72-php-fpm
vim /etc/opt/remi/php72/php-fpm.d/www.conf
[root@blog nginx]# grep nginx /etc/opt/remi/php72/php-fpm.d/www.conf
user = nginx
group = nginx

Nginx

yum install -y nginx
wget https://nginx.org/download/nginx-1.20.1.tar.gz

mkdir /html
unzip /software/typecho.zip 

cd /etc/nginx/
grep -Ev "#|^$" nginx.conf.default > nginx.conf
vim nginx.conf
mkdir -p /var/log/blog
chown -R nginx.nginx /var/log/blog

nginx -t
chown -R nginx.nginx /html/

systemctl start nginx
# cat /etc/nginx/nginx.conf
worker_processes  1;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;

    server {      
          listen     80;
          root      /html;
          index      index.html index.htm index.php;

          if (!-e $request_filename) {
            rewrite ^(.*)$ /index.php$1 last;
          }

          location ~ .*\.php(\/.*)*$ {
            include fastcgi.conf;
            fastcgi_pass 127.0.0.1:9000;
          }

          access_log /html/access.log combined;
    }

}

访问

0

评论

博主关闭了当前页面的评论