Long Yun-Dimensional road--the construction of lamp platform based on FPM

Source: Internet
Author: User

BuildLAMPplatform, you can putPHPcompiled toApachea module or directlyPHPcompiled into a separate service, then run independently, whenApacheNeed andPHPwhen communicating,Apacheit becomes a client, to thePHPThe request is initiated and then by thePHPputApacheSend the code to explain and send backApache, and finally byApachereturned to the client.

FPM lamp Span style= "font-family: ' The song Body '; > platform, you can use two or three virtual machines, respectively, to compile the apache php and MARIADB Here I use two virtual machines. A standalone run mariadb another run apache and php

host

Run service

For Apache and MariaDB , compile-and-install can refer to http://7703592.blog.51cto.com/7693592/1649948 don't dwell on it here. A direct introduction to PHP installation.

Download php-5.5.40 Unzip and switch to unzip file directory to execute the following command

[Email protected] php-5.4.40]#/configure--prefix=/usr/local/php--enable-fpm--enable-mbstring-- With-freetype-dir--with-jpeg-dir--with-png-dir--with-zlib--with-libxml-dir=/usr/--enable-xml--enable-sockets-- With-mcrypt--with-bz2--with-config-file-path=/etc/php/php.ini--with-config-file-scan-dir=/etc/php.d/
[[email protected] php-5.4.40]# make && make install

To provide a running script for PHP

[[email protected] php-5.4.40]# CP Sapi/fpm/init.d.php-fpm/etc/rc.d/init.d/php-fpm[[email protected] php-5.4.40]# chmod +x/etc/rc.d/init.d/php-fpm#: Execute permissions for script [[email protected] php-5.4.40]# chkconfig--add php-fpm# Add to Chkconfig list [[ e-Mail protected] php-5.4.40]# chkconfig php-fpm on# set boot from

To provide a configuration file for a service

[Email protected] php-5.4.40]# cp/usr/local/php/etc/php-fpm.conf.default/usr/local/php/etc/php-fpm.conf

Edit the configuration file, set the following parameters

Pm.max_children = 50#: Sets the maximum number of child processes

pm_start_servers = AA: Set the number of pre-boot processes to 5

pm.min_spare_servers = *: Set minimum number of idle child processes to 2

Pm.max_spare_servers = 8#: Set the maximum number of idle child processes to 8

Pid =/usr/local/php/var/run/php-fpm.pid#: Set process file Location

Now it's time to start the service test.

[[Email protected] php-5.4.40]# service PHP-FPM start

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6C/A7/wKioL1VPaxWT0nfLAADl0YvaBbQ001.jpg "title=" 24.png "Width=" height= "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:600px;height:68px; "alt=" Wkiol1vpaxwt0nflaadl0yvabbq001.jpg "/>


by the knowable The php-fpm process listens to the 9000 Port on this machine by default ,

Configuring the Apache configuration file


650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6C/A7/wKioL1VPaz2xv11MAAIBrtXQJls944.jpg "title=" 25.png "Width=" "height=" 143 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:600px;height:143px; "alt=" Wkiol1vpaz2xv11maaibrtxqjls944.jpg "/>


As shown, start the following two modules:

Proxy_fcgi_module modules/mod_proxy_fcgi.so

Proxy_module modules/mod_proxy.so

Configure Apache Central host to support reverse proxy

include the following two entries in the Apache configuration file

Proxyrequests OFF

Proxypassmatch ^/(. *\.php) $ fcgi://127.0.0.1:9000/usr/local/apache/htdocs/$1

Edit the Apache Center Host's paging file /usr/local/apache/htdocs/index.php file for testing use, add the following:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6C/A7/wKioL1VPa4qTerHwAAGgy-gXxX4383.jpg "title=" 26.png "Width=" "height=" 268 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:600px;height:268px; "alt=" Wkiol1vpa4qterhwaaggy-gxxx4383.jpg "/>

Restart Apache Service and php-fpm test

[[Email protected] php-5.4.40]# service PHP-FPM restart[[email protected] php-5.4.40]# service httpd restart[[email prote CTED] php-5.4.40]# service iptables stop#: Turn off the firewall before you can test using a physical machine.

The following page appears, successfully

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6C/A7/wKioL1VPa6uABPy5AAOsaQMXeaY869.jpg "title=" 27.png "Width=" "height=" "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:600px;height:350px; "alt=" Wkiol1vpa6uabpy5aaosaqmxeay869.jpg "/>

Close PHP-FPM Service after testing again, the results are as follows


650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6C/AC/wKiom1VPaleQ8f2nAAGZi8cSGOY973.jpg "title=" 28.png "Width=" "height=" 341 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:600px;height:341px; "alt=" Wkiom1vpaleq8f2naagzi8csgoy973.jpg "/>

to this php in the FPM mode work test completed, in this use is two days host, if you want to compile php as a separate host, to fpm mode work, can be configured as described above, only need to modify its configuration file php.ini The listening address in the Apache the address where the host is located.


This article is from the "linux-Bubble" blog, make sure to keep this source http://7703592.blog.51cto.com/7693592/1650088

Long Yun-Dimensional road--the construction of lamp platform based on FPM

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.