云主机Centos7下WordPress部署指南

参考文章:

https://blog.csdn.net/qq_25504829/article/details/104254788

一、天翼云安全组添加端口

控制中心——>虚拟私有云——>访问控制——>安全组——>选择default,点击“快速添加规则”,在入方向和出方向分别加入新的端口号2020,如下图所示:
在这里插入图片描述

二、Apache安装

1、安装lrzsz和vim(可选)

yum -y install lrzsz
yum -y install vim

2、安装apache服务

yum -y install httpd

3、设置httpd开机自启

systemctl enable httpd

4、启动httpd

systemctl start httpd.service

5、查看httpd状态

systemctl status httpd.service

在这里插入图片描述

6、修改httpd的配置文件,加入新的端口号2020

vim /etc/httpd/conf/httpd.conf

在这里插入图片描述
然后ESC——输入“:wq”保存退出(后面不再赘述)

7、修改好后记得要重启服务,后面数据库也是一样

systemctl restart httpd-service

8、在本地浏览器中输入公网ip+“:2020”,比如我是http://49.7.128.237:2020,看看是否如下图所示打开测试页
在这里插入图片描述

三、MariaDB安装

1、Centos7中的mariadb是残次品,需要先检查一下,如果有就卸载重装
1)、检测有没有mariadb

rpm -qa | grep mariadb

2)、卸载mariadb

rpm -e –nodeps mariadb-libs-5.5.60-1.el7_5.x86_64

在这里插入图片描述
3)、安装mariadb

yum -y install mariadb-server

4)、开机启动

systemctl enable mariadb.service

5)、启动mariadb

systemctl start mariadb.service

在这里插入图片描述

2、初始化配置
输入mysql_secure_installation
在这里插入图片描述

3、创建wordpress数据库
1)、登录数据库

mysql -u root -p

在这里插入图片描述
2)、创建数据库(创建一个名字为wordpress的字符集为utf8的数据库)

create database wordpress character set utf8;

3)、添加一个wordpress的用户(添加一个名字为root密码为12345的用户)

grant all privileges on wordpress.* to ’root’@’localhost’ identified by ‘123456’;

4)、刷新数据库权限信息

flush privileges;

5)、退出

exit;

在这里插入图片描述

四、PHP安装

1、清除历史php

yum -y remove php*

2、修改yum源
注:安装php72w,是需要配置额外的yum源地址的,否则会报错不能找到相关软件包。
php高版本的yum源地址,有两部分,其中一部分是epel-release,另外一部分来自webtatic。如果跳过epel-release的话,安装webtatic的时候,会有错误报出。

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

在这里插入图片描述

3、安装php7.2

yum -y install php72w

4、安装php拓展

yum -y install php72w-cli php72w-fpm php72w-mysqlnd

5、测试php
说明:在Apache网页目录下创建一个以.php结尾的php文件并重启httpd服务
1)、新建一个test.php文件

vim /var/www/html/test.php

2)、在文本中输入下面内容

<?php
	phpinfo();
	?>

3)、保存退出后重启httpd

systemctl restart httpd.service

在这里插入图片描述
4)、如下图所示结果说明成功
在这里插入图片描述

五、WordPress安装

1、先切换到/var/www下

cd /var/www

2、rz把之前下载的wordpress上传
在这里插入图片描述

3、解压缩latest-zh_CN.tar.gz

tar -zxvf latest-zh_CN.tar.gz

4、将wordpress下的文件全部复制到html下

cp -r wordpress/* html/

5、配置wordpress
1)、切换到html下后复制一份wp-config-sample.php

cp wp-config-sample.php wp-config.php

在这里插入图片描述
2)、修改具体配置

vim wp-config.php

在这里插入图片描述

6、重启httpd

systemctl restart httpd.service

7、输入网址公网ip:2020/进入
如:http://49.7.128.237:2020/
即可显示下面欢迎页,根据提示填写资料和操作
在这里插入图片描述

六、WordPress使用配置

1、解决无法复制黏贴图片的问题
在这里插入图片描述
解决办法:
修改目录wp-content的权限

chmod -R 777 /var/www/html/wp-content

2、设置主题更新等需要连外网

vim /var/www/html/wp-config.php

在这里插入图片描述

七、一些比较常用的Linux命令

1、查看linux版本(centos)
cat /etc/redhat-release

2、查看mysql版本
mysql -v

3、查看硬盘使用情况
df -h

4、查看ip地址
ifconfig -a

5、安装apache、php、mariadb
yum install -y httpd php-fpm mariadb mariadb-server php-mysql

6、安装nginx
yum install epel-release
yum install nginx-y

7、启动相应的服务
systemctl start httpd.service
systemctl restart httpd.service
systemctl start mariadb
systemctl start php-fpm

8、检查服务运行情况
netstat -tunlp

9、修改apache的端口
vim /etc/httpd/conf/httpd.conf

10、查看防火墙
sudo systemctl status firewalld

11、打开防火墙
sudo systemctl start firewalld

12、关闭防火墙
sudo systemctl stop firewalld

13、添加端口号
firewall-cmd --zone=public --add-port=80/tcp --permanent   (--permanent永久生效,没有此参数重启后失效)

14、重新载入(必须)
firewall-cmd --reload

15、查看所有打开的端口
firewall-cmd --zone=public --list-ports
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值