关于centos:Centos8搭建LANM环境

3次阅读

共计 1324 个字符,预计需要花费 4 分钟才能阅读完成。

===============

LNMP 环境是指在 Linux 零碎下,由 Nginx + MySQL/MariaDB + PHP 组成的网站服务器架构

Ngnix 装置

参考 Nginx 官网的装置领导

1. 向 yum repository 增加 nginx

vim /etc/yum.repos.d/nginx.repo

# 插入以下内容
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/cen…$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

2.yum 装置

yum install -y nginx

3.nginx 启动

systemctl start nginx

4.nginx 自启动

systemctl enable nginx

MariaDB 装置

MariaDB 的官网装置领导

1. 向 yum repository 增加 MariaDB

vim /etc/yum.repos.d/MariaDB.repo

# 插入以下内容
# MariaDB 10.5 CentOS repository list – created 2020-08-12 04:21 UTC
# http://downloads.mariadb.org/…
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.5/c…
module_hotfixes=1
gpgkey=https://yum.mariadb.org/RPM-G…
gpgcheck=1

2.yum 装置

  • 蕴含客户端和服务端

yum -y install MariaDB-client MariaDB-server

3.MariaDB 启动

  • 开启服务器

systemctl start nginx

4.MariaDB 自启动

  • 设置开启启动

systemctl enable nginx

装置配置 PHP

1. 启用 EPEL

PEL 代表“Extra Packages for Enterprise Linux”,它是一个自在开源的附加软件包仓库,可用于 CentOS 和 RHEL 服务器。顾名思义,EPEL 仓库提供了额定的软件包,这些软件在 CentOS 8 和 RHEL 8 的默认软件包仓库中不可用。

  • 装置 EPEL 包

    rpm -Uvh https://mirrors.cloud.tencent.com/epel/epel-release-latest-8.noarch.rpm

2. 装置 PHP

yum -y install php-cli.x86_64 php-common.x86_64 php-mysqlnd php-fpm.x86_64

  • 装置的是 7.2.24 版本的

3. 启动 PHP-FPM 服务

systemctl start php-fpm

4.PHP-FPM 服务开机自启动

systemctl enable php-fpm

5. 测试

echo "<?php phpinfo(); ?>" >> /usr/share/nginx/html/index.php

  • 重新启动 Nginx 服务
  • 拜访 80 端口
  • 内容是版本信息,PHP 装置胜利
正文完
 0