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

LNP+MYSQL Master-Slave practice based on Source Code compilation and yum installation

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

Share

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

1. Master-slave practice of LNP+MYSQL based on source code compilation and installation

Prepare 3 servers, one as Nginx WEB server + PHP-FPM (FastCGI), and the other two as MYSQL master and slave servers, server IP information:

 10.10.10.4-Linux+Nginx+PHP

 10.10.10.5-MYSQL Master

 10.10.10.6-MYSQL Slave

 1) Nginx installation configuration

 # installs PCRE libraries and basic library support

 yum install pcre-devel pcre gcc-c++ openssl openssl-devel zlib-devel-y

 cd / usr/src

 # download Nginx source code package

 wget-c http://nginx.org/download/nginx-1.12.0.tar.gz

 tar-xzf nginx-1.12.0.tar.gz

 cd nginx-1.12.0

 # enters the decompressed directory, and then sed modifies the Nginx version information to JWS

 sed-I-e's src/core/nginx.h 1.12.0 src/core/nginx.h g'- e 's/nginx\ / / JWS/g'-e's / "NGINX" / "JWS" / g' src/core/nginx.h

 # precompiled Nginx

 useradd www;. / configure-user=www-group=www-prefix=/usr/local/nginx-with-http_stub_status_module-with-http_ssl_module

After  # is compiled successfully, execute the make command to compile

 make

After the successful execution of  # make, perform the official installation of make install

 make install

 # checks whether the nginx configuration file is correct and returns OK.

 / usr/local/nginx/sbin/nginx-t

 # you can enter. Check to see if the process has started:

 then starts nginx,/usr/local/nginx/sbin/nginx

 2) php installation configuration

 wget http://museum.php.net/php5/php-5.6.9.tar.gz

 yum-y install gd curl curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel mysql-devel

 tar-xzf php-5.6.9.tar.gz

 cd php-5.6.9

. / configure-prefix=/usr/local/php5-enable-fpm-enable-debug-with-gd-with-jpeg-dir-with-png-dir-with-freetype-dir-enable-mbstring-with-curl-with-mysql=mysqlnd

-with-mysqli=mysqlnd

-with-pdo-mysql=mysqlnd

-disable-fileinfo

Mysqli extension has a series of advantages, compared with mysql extension, the main improvements are: object-oriented interface, prepared statement support, multi-statement execution support, transaction support, enhanced debugging ability, embedded service support.

Make

Make install

\ cp php.ini-development / usr/local/php5/lib/php.ini

\ cp / usr/local/php5/etc/php-fpm.conf.default / usr/local/php5/etc/php-fpm.conf

\ cp / usr/src/php-5.6.9/sapi/fpm/init.d.php-fpm / etc/init.d/php-fpm

Chmod 755 / etc/init.d/php-fpm

Chkconfig-add php-fpm

Chkconfig php-fpm on

Php parser: used to parse PHP pages

Php-fpm Manager: used to manage and invoke and open PHP parsers.

Php-fpm.conf is one of the important configuration files for the php service program. We need to enable the pid file save directory on line 25 of this configuration file, and then modify the user and group parameters on lines 148 and 149to the www account and user group names, respectively:

Vim / usr/local/php5/etc/php-fpm.conf

1

2; FPM Configuration

3

23; Note: the default prefix is / usr/local/php/var

24; Default Value: none

25 pid = run/php-fpm.pid

. Omit some of the output information.

145mm; Unix user/group of processes

Note: The user is mandatory. If the group is not set, the default user's group

147c; will be used.

148user = www

149 group = www

. Omit some of the output information.

(4) Nginx profile configuration

Cat / usr/local/nginx/conf/nginx.conf

Events {

Worker_connections 1024

}

Http {

Include mime.types

Default_type application/octet-stream

Server {

Listen 80

Server_name localhost

Location / {

Root / usr/local/nginx/html

Index index.html index.php

}

Location ~ .php ${

Root html

Fastcgi_pass 127.0.0.1:9000

Fastcgi_index index.php;#

Fastcgi_paramSCRIPT_FILENAME

S/usr/local/nginx/html$fastcgi_script_name

Include fastcgi_params

}

}

.

Cat > / usr/local/nginx/html/index.php

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