centos7 yum搭建lnmp环境及配置wordpress超详细教程

本教程详述如何在CentOS7上搭建LNMP环境,包括Nginx的安装配置、MariaDB的初始化、PHP的安装与启动,以及WordPress的数据库配置和网站设置。通过此教程,你可以成功创建运行WordPress的服务器环境。
摘要由CSDN通过智能技术生成

LNMP四部曲

①Linux,操作系统
②Nginx,网页服务器
③MariaDB或MySQL,数据库管理系统(或者数据库服务器)
④PHP、Perl或Python,脚本语言

搭建LNMP环境

Nginx安装及配置

配置nginx源

[root@localhost ~]# rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

安装nginx

[root@localhost share]# yum install nginx -y
[root@localhost ~]# nginx -v
nginx version: nginx/1.16.1
[root@localhost /]# systemctl enable nginx
[root@localhost /]# systemctl start nginx
(注) 文件默认位置: 
二进制文件		/usr/sbin/nginx
配置文件夹		/etc/nginx/
log文件夹		/var/log/nginx

在这里插入图片描述
我们可以看到nginx已经正常工作了

MariaDB安装

[root@localhost ~]# yum install mariadb-server
[root@localhost /]# systemctl enable mariadb
[root@localhost /]# systemctl start mariadb

初始化数据库

[root@localhost /]# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):     #回车
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y    #设置root用户密码
New password:                 #输入密码
Re-enter new password:        确认密码
Password updated successfully!
Reloading privilege tables..
 ... Success!


By def
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值