Centos 7 deployment lnmp cluster architecture

Preface Introduction

  • lnmp is full linux + nginx + mysql + php;
  • lnmp is abbreviated combination of the system and application programs;
  • lnmp is already represents a user for the normal flow of a page request, nginx receives the request, mysql data storage, php back-end process; lamp or similar architecture as well as linux + nginx + mysql + java like;
  • lnmp called lemp, foreigners like to call lemp, Chinese people like to call lnmp;
  • lnmp compared to the advantages of lamp architecture is lightweight, relatively simple; lamp advantages in terms of nginx module relative to the rich;

 

Environment Configuration

Numbering software version
1 Centos 7
2 nginx 1.175
3 mysql 5.7
4 php 7.5

 

 

 

 

 

 

 

The PS : the operating system is to minimize the installation, all operations belong to online operation, but may be replaced with offline; all deployment operations are implemented according to the following procedure. And I deployed on top of the machine ss, to make proxy requests http and https, because my family all these open source network official website too card

 

Deployment Details

1, pre-installation preparation

sed -i 's/enforcing/disabled/' /etc/selinux/config
rpm -qa | grep "firewall" | xargs rpm -e --nodeps
rpm -qa | grep "iptables" | xargs rpm -e --nodeps
sed -i 's/.*UseDNS.*/UseDNS no/' /etc/ssh/sshd_config
systemctl restart sshd
reboot

 

2, the agent installation ss

https://www.cnblogs.com/guge-94/p/11363303.html

 

3, install the database

https://www.cnblogs.com/guge-94/p/10552374.html

 

4, install php

yum -Y the install the libxml2 the libxml2-devel OpenSSL OpenSSL-devel zlib zlib-devel PCRE PCRE- devel
 wget HTTPS: // www.php.net/distributions/php-7.3.11.tar.gz -P / opt / 
the tar -zxf / opt / PHP- 7.3 . . 11 . the tar .gz -C / opt / 
CD / opt / PHP- 7.3 . . 11 
. / Configure --prefix = / usr / local / PHP-FPM --with --enable-fpm- FPM = WWW --with-User-Group-BCMath --enable --enable = WWW---enable- the shmop FTP --with- OpenSSL
 the make -j8 && the make  the install 
the make test this test procedure # exceptionally long, optionally execution; mainly used to test the compiled results

# Profile is generated 
PS: fpm compile the source code included in the installation, but the mounting-line is installed or yum need to specify a separate 
CP /usr/local/php/etc/php-fpm.conf.default / usr / local / PHP / etc / PHP- fpm.conf
 cp / opt / PHP- 7.3 . 11 /php.ini-production / usr / local / PHP / etc / the php.ini
 cp / opt / PHP- 7.3 . 11 /sapi/fpm/init.d FPM-/etc/init.d/php- .php FPM
 cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/ www.conf # basic configuration of


 the chmod A + X /etc/init.d/php- FPM 
the groupadd WWW 
the useradd -s / sbin / nologin -g WWW - M WWW
/etc/init.d/php-fpm start
ln -s /usr/local/php/bin/* /usr/bin/
ln -s /usr/local/php/sbin/* /usr/sbin/

PS : I did not like here online as installation lnmp lamp or the environment when out on a lot of plug-ins; one most people do not know the function of all plug-ins, plug-ins or extensions dependent functions must be based on appropriate business scenarios set, I am here just the other experiment, if you want to add any subsequent plug-in, on the basis of the article do add

 

5, install nginx

https://www.cnblogs.com/guge-94/p/11758498.html

 

6, the detection result of the installation

mkdir -p / the Data / the WWW
 CAT / the Data / the WWW / index.php 
# write a simple php-check the entire lnmp environment
<HTML> < head > <title> PHP Test </ title> </ head > <body> < ? PHP echo ' <the p-> the Hello World </ the p->! ' ;?> </ body> </ HTML> CAT / etc / nginx / nginx.conf # this is a report on the basis of nginx configuration. For self-optimizing may be carried out on this basis optimization User WWW WWW; worker_processes . 1 ; Events { worker_connections 1024 ; } http { default_type application
include mime.types;/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; server_name localhost; index index.php index.html index.htm; root /data/www; location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } } chown -R www.www /data/www nginx -t nginx -s reload

After completion of the above operation through a browser or curl request to look at the host address

Guess you like

Origin www.cnblogs.com/guge-94/p/11827304.html