Centos7.3 Methods for setting up LNMP environment

  • 2020-11-18 06:34:38
  • OfStack

This article illustrates how es1EN 7.3 server builds LNMP environment. To share for your reference, the details are as follows:

[

Requirements: Set up LNMP environment under Centos7.3

]

1. Close the firewall and selinux

Open file selinux


vim /etc/sysconfig/selinux

Change the file SELINUX=enforcing to disabled, and then execute "setenforce 0" to close selinux without restarting.


SELINUX=disabled

Close the arson wall


systemctl stop firewalld.service

2. Install the software

2.1 MYSQL installation

Download the repo source for mysql


wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

Install mysql community - release el7-5. noarch. rpm package


rpm -ivh mysql-community-release-el7-5.noarch.rpm

Install MYSQL


sudo yum install -y mysql-server

Change MYSQL user permissions:


sudo chown -R root:root /var/lib/mysql

Restart service:


systemctl restart mysql.service

Log in and change your password:


mysql -u root
mysql > use mysql;
mysql > update user set password=password( ' 123456 ' ) where user='root';
mysql > flush privilgegs;
mysql > exit;

2.2 nginx installation

Download the nginx package for the current system version

wget http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

Set up yum warehouse for nginx (default yum does not have nginx)


rpm -ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm

Download and install nginx


SELINUX=disabled

0

nginx start


SELINUX=disabled

1

2.3 installation php

rpm Installs the corresponding yum source for Php7


SELINUX=disabled

2

Install php7. 0


yum install -y php70w

Install the php extension

yum install -y  php70w-mysql.x86_64   php70w-gd.x86_64   php70w-ldap.x86_64   php70w-mbstring.x86_64  php70w-mcrypt.x86_64

Install PHP FPM


SELINUX=disabled

4

3. Modify the configuration file

3.1 Modify the Nginx configuration file

nginx configuration file location: (/ etc nginx/conf d/default conf)


SELINUX=disabled

5

Modify the root directory to customize:


SELINUX=disabled

6

Modify configuration php


SELINUX=disabled

7

3.2 Modify the php-fpm configuration file

php - fpm configuration file location: (/ etc/php - fpm. d/www conf)

Modify the


user =nginx
group=nginx

4. Put in the test file


SELINUX=disabled

9

5. Start the service

5.1 Start nginx Service:


systemctl start nginx.service

View the startup status:


systemctl status nginx

See the following words to indicate successful startup!

​Active: active (running) since 6 2016-11-19 13:40:04 CST; 50min ago

5.2 Start PHP-FPM:


systemctl start php-fpm.service

View the startup status:


systemctl stop firewalld.service

3

See the following words to indicate successful startup!

​Active: active (running) since 6 2016-11-19 14:14:33 CST; 18min ago

Test 6.

Open 192.168.44.129:80 / index.php in your browser

See hello eric and you're done

Hopefully this article has helped you with your CentOS server configuration.


Related articles: