使用LAMP平台部署Wordpress服务器

LAMP = Linux + Apache + MySQL/MariaDB + PHP/Python

1、安装CentOS Linux 7

2、安装MariaDB

yum install -y mariadb mariadb-server

3、yum安装httpd

yum install -y httpd httpd-devel

4、安装编译器gcc

yum install -y gcc

5、编译安装php

yum -y install libxml2 libxml2-devel
wget https://www.php.net/distributions/php-7.3.5.tar.gz
tar xvf php-7.3.5.tar.gz
cd php-7.3.5
./configure --with-apxs2=/usr/bin/apxs --with-pdo-mysql  --with-mysqli --with-zlib --without-pear --disable-phar
make
make install

成功编译安装完成后,再安装pear

wget  http://pear.php.net/go-pear.phar 
/usr/local/bin/php go-pear.phar
cp php.ini-production /usr/local/php/php.ini

6、安装完成后配置Apache

vim /etc/httpd/conf/httpd.conf
#添加下面一段话
<FilesMatch \.php$>
    SetHandler application/x-httpd-php
</FilesMatch>

#<IfModule dir_module>
#搜索index.html,在其后添加index.php
#:/index.html
#:wq

在这里插入图片描述

7、配置一个虚拟主机

vim /etc/httpd/conf.d/1.conf
<VirtualHost *:80>
      DocumentRoot     /var/www/html
      ServerName          localhost
</VirtualHost>

在这里插入图片描述

systemctl restart httpd
systemctl enable httpd

8、防火墙的处理

firewall-cmd --add-port=3306/tcp --permanent
firewall-cmd --add-port=80/tcp --permanent
firewall-cmd --add-service=http --permanent
firewall-cmd --reload

自行下载下载phpMyAdmin、Wordpress包。

9、解压修改phpMyAdmin

tar -xvf phpMyAdmin.tar
cd phpMyAdminxxxx
cp config.sample.inc.php config.inc.php

vim config.inc.php
blowfishsecret='1234567890abcdefghijklmnopqrstuvwxyz'

$cfg['Servers'][$i]['controlhost'] = 'localhost';
$cfg['Servers'][$i]['controlport'] = '3306';
$cfg['Servers'][$i]['controluser'] = 'root';
$cfg['Servers'][$i]['controlpass'] = '123456';
:wq

10、解压和移动Wordpress文件

tar -xvf wordpress.tar
rm -f /var/www/html/*
cp -r wordpress/* /var/www/html

11、修改selinux设置

setsebool -P httpd_can_network_connect 1
setsebool -P httpd_can_network_connect_db 1
restorecon -rv /var/www/html
ausearch -c 'httpd' --raw | audit2allow -M my-httpd
semodule -i my-httpd.pp
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html'

restorecon -Rv /var/www/html
chown -R apache:apache /var/www/html

12、修改数据库密码和添加wordpress管理员

systemctl start mariadb
systemctl enable mariadb
mysqladmin -u root -p password '123456'
#回车空密码跳过
mysql -u root -p
>create database wordpress;
>grant all privileges on wordpress.* to tom@localhost identified by 'Ab123456';
>grant all privileges on wordpress.* to tom@127.0.0.1 identified by 'Ab123456';
>flush privileges;
>exit;

13、浏览器访问服务器安装wordpress
用浏览器访问http://192.168.127.131
数据库名称:wordpress
数据库用户:jerry
数据库密码:Ab1234
主机地址:127.0.0.1
前缀:wp_

将生成的配置拷贝下来,到shell中
vi /var/www/html/wp-config.php
粘贴
:wq

完成上面的操作后,再点击生成网站
在这里插入图片描述
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值