服务器部署wordpress

基于Centos7、PHP7.4环境部署wordpress

# 前置

安装虚拟机,最好是完整的,避免不必要问题。

确定可以ping通外网

vi /etc/sysconfig/network-scripts/ifcfg-ens33

service network restart 

# 安装httpd

systemctl stop firewalld

systemctl disable firewalld

setenforce 0

vi /etc/selinux/config

#SELINUX=disabled # 改成disabled

yum -y install httpd

systemctl start httpd

systemctl enable httpd

# 安装mariadb

yum install -y mariadb-server mariadb

systemctl start mariadb

systemctl enable mariadb

mysql_secure_installation

# 安装php7.4

yum install epel-release -y

yum -y install epel-release

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

yum -y install php74-php

yum install epel-release

rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

yum --enablerepo=remi install php74-php

yum --enablerepo=remi install php74-php php74-php-gd php74-php-xml php74-php-sockets php74-php-session php74-php-snmp php74-php-mysql

yum install php74-php-mysqlnd

systemctl restart httpd

# 测试php

vi /var/www/html/index.php

<?php phpinfo(); ?>

systemctl restart httpd

# 安装wordpress

yum install wget

wget https://cn.wordpress.org/latest-zh_CN.tar.gz

cp latest-zh_CN.tar.gz /var/www/html

cd /var/www/html/

tar zxvf latest-zh_CN.tar.gz

chown -R apache:apache wordpress/

# 创建数据库

mysql -u root -p

create database wordpressdb;

CREATE USER wordpressuser@localhost IDENTIFIED BY '123456';

grant all privileges on wordpressdb.* to wordpressuser@localhost;

flush privileges;

exit

# 修改wordpress配置文件

vi wp-config-sample.php

define( 'DB_NAME', 'wordpressdb' ); //修改为第四步自己新建数据库的名称

/** MySQL database username */

define( 'DB_USER', 'wordpressuser' ); //修改为第四步自己新建数据库用户的用户名

/** MySQL database password */

define( 'DB_PASSWORD', '123456' ); //修改为第四步自己新建数据库用户的密码

# 测试

打开ip/wordpress

作品展示:http://anyiya.top/

yum安装比较玄学,本篇测试于21年12月,多机器多次测试均无问题。

 
posted @ 2021-12-08 18:18  anyiya  阅读(129)  评论(0编辑  收藏  举报