Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build LNMP Environment for Centos7.3 Server

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the Centos7.3 server how to build LNMP environment, the article is very detailed, has a certain reference value, interested friends must read it!

1. Turn off the firewall and selinux

Open the file selinux

Vim / etc/sysconfig/selinux

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

SELINUX=disabled

Close the arson wall

Systemctl stop firewalld.service

two。 Install softwar

2.1 MYSQL installation

Download the repo source for mysql

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

Install the 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 the MYSQL user rights:

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

Restart the service:

Systemctl restart mysql.service

Log in and change the password:

Mysql-u rootmysql > 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 corresponding to the current system version

The copy code is as follows:

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

Set up a yum repository for nginx (there is no nginx by default for yum)

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

Download and install nginx

Yum install-y nginx

Nginx start

Systemctl start nginx.service

2.3 install php

Rpm installs the corresponding yum source for Php7

Rpm-Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpmrpm-Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

Install php7.0

Yum install-y php70w

Install the php extension

The copy code is as follows:

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

Yum install-y php70w-fpm

3. Modify the configuration file

3.1 modify Nginx configuration file

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

Vim / etc/nginx/conf.d/default.conf

Modify the root directory to customize:

Root / forest/nginxDir/html

Modify the configuration php resolution:

Location ~ .php$ {root / forest/nginxDir/html; fastcgi_pass 127.0.0.1 root 9000; fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params;}

3.2 modify php-fpm configuration file

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

Modify

User = nginxgroup=nginx

4. Put in the test file

Cd / forest/nginxDir/htmlecho 'hello eric' > index.php

5. Start the service

5.1 start the nginx service:

Systemctl start nginx.service

View startup status:

Systemctl status nginx

See the following words to indicate that the startup is successful!

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

5.2 start PHP-FPM:

Systemctl start php-fpm.service

View startup status:

Systemctl status php-fpm.service

See the following words to indicate that the startup is successful!

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

6. test

Open 192.168.44.129:80/index.php in the browser

These are all the contents of the article "how to build a LNMP environment on a Centos7.3 server". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report