lamp架构部署wordpress

CentOS 7

主机:lamp.example.com

IP:192.168.100.10

1、关闭防火墙与selinux

复制代码
 # 关闭防火墙
 systemctl stop firewalld
 systemctl disable firewalld
 # 关闭selinux
 vim /etc/selinux/config # 或vim /etc/sysconfig/selinux
 SELINUX=disabled
 :wq
 # 重启
 reboot 

2、开启时钟同步

复制代码
yum -y install chrony # 如果没有的话
systemctl restart chronyd
systemctl enable chronyd
hwclock -w

3、安装httpd与mariadb数据库

复制代码
 cd /etc/yum.repos.d/
 rm -rf * # 删除原有的.repo
 # 使用阿里源
 curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
 # 下载epel-release源
 yum -y install epel-release
复制代码
 # 下载httpd、mariadb、mariadb-server
 yum -y install httpd
 yum -y install mariadb
 yum -y install mariadb-server

4、初始化数据库

复制代码
 systemctl restart mariadb
 systemctl enable mariadb
 mysql_secure_installation
 # Set root password? [Y/n] y
 # Remove anonymous users? [Y/n] y
 # Disallow root login remotely? [Y/n] n
 # Remove test database and access to it? [Y/n] y
 # Reload privilege tables now? [Y/n] y

5、安装PHP

复制代码
 yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
复制代码
 yum -y install yum-utils
 yum-config-manager --enable remi-php70
复制代码
 yum -y install php php-cli php-fpm php-gd php-curl php-zip php-mbstring php-opcache php-intl php-mysqlnd
 pvp -v # 查看PHP

6、配置php,将时区改成亚洲/上海

复制代码
vim /etc/php.ini
date.timezone = Asia/Shanghai
:wq
systemctl restart php-fpm
systemctl enable php-fpm

7、配置默认网页

复制代码
vim /etc/httpd/conf/httpd.conf

<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>

:wq
复制代码
vim /var/www/html/index.php
<?php
        phpinfo();
?>
:wq

systemctl restart httpd
systemctl enable httpd

8、测试访问lamp基础架构

在本地浏览器上输入192.168.100.70

9、将wordpress压缩包上传到服务器并解压

复制代码
mkdir /myforum
cd /myforum

直接wordpress压缩包拖入Xshell中

复制代码
tar -xzvf wordpress-6.5.5.tar.gz
复制代码
cp -R /myforum/wordpress /var/www/html/

10、设置wordpress的权限

复制代码
chown -R apache.apache /var/www/html/wordpress
chmod -R 775 /var/www/html/wordpress

11、为wordpress配置数据库

复制代码
mysql -u root -p
复制代码
create database wordpress_db
create user 'wordpress_user'@'localhost' identified by '123456';
grant all on wordpress_db.* to 'wordpress_user'@'localhost';
flush privileges;
exit

12、为wordpress部署站点

复制代码
cp -p /usr/share/doc/httpd-2.4.6/httpd-vhosts.conf /etc/httpd/conf.d/
vim /etc/httpd/conf.g/httpd-vhosts.conf

<VirtualHost 192.168.100.70:80>
    DocumentRoot "/var/www/html/wordpress/"
    <Directory "/var/www/thml/wordpress">
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>
</VirtualHost>

:wq
# 重启httpd服务
systemctl restart httpd

13、使用浏览器访问wordpress站点

打开浏览器输入192.168.100.70/wp-admin

输入数据库名、用户名、密码;注意不要输错

相关推荐
海上生明月丿2 小时前
微服务02
微服务·架构
RestCloud2 小时前
iPaaS 与传统 ESB 的区别,企业该如何选择?
前端·架构
百度智能云3 小时前
MySQL内核革新:智能拦截全表扫描,百度智能云守护数据库性能与安全
架构
LQ深蹲不写BUG3 小时前
微服务事务管理利器:Seata 核心原理与实践指南
微服务·云原生·架构
失散133 小时前
分布式专题——5 大厂Redis高并发缓存架构实战与性能优化
java·redis·分布式·缓存·架构
kida_yuan4 小时前
【从零开始】12. 一切回归原点
python·架构·nlp
正在起飞的蜗牛5 小时前
【C语言】函数指针的使用分析:回调、代码逻辑优化、代码架构分层
c语言·架构
云和数据.ChenGuang6 小时前
微服务技术栈
微服务·云原生·架构
知识分享小能手8 小时前
React学习教程,从入门到精通, React 新创建组件语法知识点及案例代码(11)
前端·javascript·学习·react.js·架构·前端框架·react
江团1io08 小时前
微服务雪崩问题与系统性防御方案
微服务·云原生·架构