Centos 7.5 编译安装搭建wordpress

Centos 7.5 安装LNMP平台

一台Centos 7.5虚拟机

安装软件包

[root@localhost /]# yum install -y epel-*

[root@localhost /]# yum install -y nginx mariadb-server php php-mysql \

> php-fpm  \php-xml php-pecl-zip php-json php-devel wget vim

 

配置nginx支持PHP

  1. 创建nginx的web主目录
  2. [root@localhost /]# mkdir /var/wwwroot
  3. [root@localhost /]# cd /var/wwwroot/
  4. [root@localhost wwwroot]# echo -e hello_world >> index.html
  5. [root@localhost wwwroot]# echo -e "<?php phpinfo(); ?>" >> info.php
  6. [root@localhost wwwroot]# ls

 

2、编辑nginx的配置文件

[root@localhost /]# vim /etc/nginx/nginx.conf

3、修改nginx主目录和索引

将http下的server下的root的值修改为/var/wwwroot

在http下的server下添加index index.php index.html index.htm

4.在http下的server区块加入以下内容

location ~ \.php$ {

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

include fastcgi_params;

}

5.启动nginx和php-fpm

[root@localhost ~]# systemctl start nginx php-fpm

[root@localhost ~]# systemctl enable nginx php-fpm

[root@localhost ~]# systemctl status nginx php-fpm

 

6.关闭防火墙

[root@localhost ~]# setenforce 0

[root@localhost ~]# systemctl stop firewalld

[root@localhost ~]# systemctl disable firewalld

7.在宿主机访问nginx

访问 http://[centos_ip]/info.php

配置MySQL

  1. 启动MySQL

[root@localhost /]# systemctl start mariadb

[root@localhost /]# systemctl enable mariadb

  1. 输入以下命令,配置MySQL

[root@localhost /]# mysql_secure_installation

 

  1. 提示 Enter current password for root (enter for none):

 

敲击回车

4.提示Set root password? [Y/n]

按Y,随后设置密码

密码设置:123(生产环境尽量不要使用弱口令密码)

 

5.提示Remove anonymous users?

意思是否删除匿名用户

 

6.提示Disallow root login remotely?

意思是远程禁止root登录吗?

 

7.提示Remove test database and access to it?

意思为删除测试数据库吗?

 

  1. 提示Reload privilege tables now?

意思是现在重新加载特权表吗?

9.登录mysql数据库

[root@localhost /]# mysql -u root -p

 

MariaDB [(none)]> show databases;

 

下载WorldPress测试LNMP环境

 

  1. 下载WordPress

[root@localhost ~]# cd /var/www/root/

[root@localhost wwwroot]# rm -rf index.html

[root@localhost wwwroot]# rm -rf info.php

[root@localhost wwwroot]# wget https://cn.wordpress.org/wordpress-4.9.4-zh_CN.tar.gz

[root@localhost wwwroot]# tar -zxvf wordpress-4.9.4-zh_CN.tar.gz

[root@localhost wwwroot]# cd wordpress/

[root@localhost /]# cp -r /var/wwwroot/wordpress/* /var/wwwroot/

[root@localhost /]# cd /var/wwwroot/

[root@localhost wwwroot]# ll

  1. 登录mysql创建数据库

[root@localhost wwwroot]# mysql -u root -p

#创建一个wordperss数据库

MariaDB [(none)]> CREATE DATABASE wordpress;

在宿主机访问nginx服务器

访问http://[centos_ip]/

按提示安装即可

 

 

 

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值