Linux learning——LNMP distributed deployment

Table of contents

I. Overview

2. LNMP environment deployment

3. Configure nginx

4. Configure php so that nginx can parse .php

 5. Configure mysql

 6. Configure discuz for login forum access test


I. Overview

LNMP stands for Linux, Nginx, MySQL, and PHP and is a commonly used server architecture. It consists of the following components:

        Linux: As an operating system, it provides the basic functions and stability of the server.

        Nginx: As a web server, it processes and responds to the client's HTTP requests and distributes the requests to the back-end PHP handler.

        MySQL: As a relational database management system, it is used to store and manage website data.

        PHP: As a server-side scripting language, used to process and generate dynamic content.

The LNMP architecture is widely used in web development because it combines excellent open source software with high performance, high stability, and high flexibility.

2. LNMP environment deployment

        Three hosts are required to deploy nginx, mysql, and php respectively to achieve LNMP distributed deployment of multiple hosts.

       Turn off the firewall, set selinux permissive mode, and configure static IP

          nginx        ip        192.168.100.3

        mysql        ip        192.168.100.4

        php ip 192.168.100.5

3. Configure nginx

        Two installation methods can be used: network source installation (need to download or configure the epel source) and compilation installation

        Mainly demonstrates the deployment of compiling and installing nginx

        1. yum installation

        yum install -y epel-release (download epel source)

        yum install -y nginx

        2. Compile and install

        Download the nginx source code package //nginx.org/en/download.html (download the nginx version you need to download)

        tar  xf nginx-1.20.2.tar.gz 

        cd nginx-1.20.2.tar.gz

 Optimize nginx commands, start and test nginx

Check whether php is parsed and found that php cannot be parsed.

 

4. Configure php so that nginx can parse .php

        Use yum to install php

        Check the php version and confirm the required version of phpMyAdmin

 Change rpm source

rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

 

        Delete the installed php related packages and install the new version of the service

        yum -y remove php*

         安装        yum install php72w php72w-cli php72w-common php72w-devel php72w-embedded php72w-fpm php72w-gd php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml php72w-ldap php72w-mcrypt

 Modify configuration file

 Because nginx is compiled and installed in the default web access directory /usr/local/nginx/html

      mkdir -p /usr/local/nginx/html and add the same test files on both sides

Modify ngin configuration file

 Access and confirm that nginx php parses php

 5. Configure mysql

Can be installed using yum (quick and convenient)

Give management users and users of ultrax database and login database

 Remote access testing on any host

 6. Configure discuz for login forum access test

Drag the discuz compressed package into the terminal to decompress it (both nginx and php services are required)

 access test

 

 

Guess you like

Origin blog.csdn.net/a872182042/article/details/132262157