lnmp架构搭建
- lnmp简单理解就是下面几个服务的结合
- Linux,这个就不多介绍了,这个是一个系统,咱们这里有的是centos版本的
- nginx,功能非常强大,简单理解就是识别html文件并多种形式展现给客户的,描述的不是很对哈,简单理解
- php,简单理解就是,网页里面有php语言编写的,需要连接到数据库里面提取数据或者存放数据的
- mysql,存放数据的,提供读取和写入数据的
废话不多说开始搭建
- 小编是个美男子,话说人狠的那种,狠主要体现在加班和谈对象方面
系统环境
| 系统 | 系统版本 | 内存 | ip | 网络模式 |
|---|---|---|---|---|
| Linux | centos7.5 | 2G | 192.168.100.133 | NAT(也就是可以上网) |
如果不能上网的话,可以把他们几个包下载下来,wget命令后面的就是包所在的网址,直接在浏览器里面输入这个网址就可以下载相对应的包了,然后把包传到相对应的服务器上面去,切记,本篇文章是单击部署,支持分布式部署
搭建nginx
[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
[root@localhost ~]# vim /etc/selinux/config #修改linux的配置文件
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
[root@localhost ~]# hostnamectl set-hostname lnmp #更改用户名为lnmp
[root@lnmp ~]# systemctl stop firewalld #关闭防火墙,当你发现网站不能正常链接的时候,检查下防火墙是否开启
[root@lnmp ~]# systemctl stop NetworkManager #关闭网络守护进程
[root@localhost ~]# init 6 #重启服务器
Connecting to 192.168.100.133:22... #再次链接服务器
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
Last login: Sat Feb 27 19:09:21 2021 from 192.168.100.1
[root@lnmp ~]#
[root@lnmp ~]# yum -y install wget #安装wget服务,用来下载软件包
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 wget.x86_64.0.1.14-18.el7_6.1 将被 安装
--> 解决依赖关系完成
依赖关系解决
=================================================================================================================================================
Package 架构 版本 源 大小
=================================================================================================================================================
正在安装:
wget x86_64 1.14-18.el7_6.1 base 547 k
事务概要
=================================================================================================================================================
安装 1 软件包
总下载量:547 k
安装大小:2.0 M
Downloading packages:
wget-1.14-18.el7_6.1.x86_64.rpm | 547 kB 00:00:03
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : wget-1.14-18.el7_6.1.x86_64 1/1
验证中 : wget-1.14-18.el7_6.1.x86_64 1/1
已安装:
wget.x86_64 0:1.14-18.el7_6.1
完毕!
[root@lnmp ~]# wget http://nginx.org/download/nginx-1.16.1.tar.gz #下载nginx包
--2021-02-27 19:37:06-- http://nginx.org/download/nginx-1.16.1.tar.gz
正在解析主机 nginx.org (nginx.org)... 3.125.197.172, 2a05:d014:edb:5704::6, 2a05:d014:edb:5702::6
正在连接 nginx.org (nginx.org)|3.125.197.17

本文详细介绍如何从零开始在CentOS 7.5环境下搭建LNMP(Linux+Nginx+MySQL+PHP)架构,包括各组件的安装配置过程及注意事项。
最低0.47元/天 解锁文章
471

被折叠的 条评论
为什么被折叠?



