Lamp deployment application based on fastcgi separation

Source: Internet
Author: User

Experimental objectives

This lamp is built on the CentOS 7 virtual machine, based on PHP-FPM (Fastcgi) to achieve the separation of httpd, PHP-FPM, MARIADB, and deployment of applications on lamp, with two virtual machines a virtual host for the provision of phpMyAdmin ; Another virtual host is used to provide WordPress, and provides xcache acceleration.

The experimental environment is deployed as follows:

httpd
172.18.12.7
Httpd-2.4.6-40.el7.centos.x86_64
php-fpm
172.18.12.8
Php-fpm-5.4.16-36.el7_1.x86_64
Mariadb
172.18.12.9
Mariadb-5.5.44-2.el7.centos.x86_64
XCache
172.18.12.8
xcache-3.2.0 (compile and install)


First, configure the MARIADB host

1. Installing the MARIADB service

Yum Install-y mariadb-server

2 Disable MySQL anti-solution host name

# VIM/ETC/MY.CNF [mysqld] Skip_name_resolve=on

3. Set a password for the MySQL administrator

# mysql_secure_installation # systemctl Start Mariadb.service

4. Authorize remote host to log in to MySQL

# mysql-uroot-h127.0.0.1-pmageedu > CREATE DATABASE testdb > GRANT all on testdb.* to [email protected] ' 172.18.%  .% ' identified by ' testpasswd '; > FLUSH privileges;

Second, configure the HTTPD host

1. Installing the HTTPD Service

# yum Install-y httpd

2. Note Center Host

# vim/etc/httpd/conf/httpd.conf #DocumentRoot "/var/www/html"

3. Create a configuration file for a virtual host

Configure a WordPress app profile # vim/etc/httpd/conf.d/wordpress.conf

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/7F/BC/wKiom1cqwjLCw3b_AAAy78P4c7M606.png "title=" 004. PNG "alt=" Wkiom1cqwjlcw3b_aaay78p4c7m606.png "/>

Configuring profiles for phpMyAdmin Apps # vim/etc/httpd/conf.d/phpadmin.conf

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/7F/B9/wKioL1cqwxyw9cO8AAAvCI_uWWY415.png "title=" 005. PNG "alt=" Wkiol1cqwxyw9co8aaavci_uwwy415.png "/>

4. Create a directory site document for a virtual machine

# mkdir-pv/web/php

4.1 Configuring the phpMyAdmin configuration file

#cd/web/php

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/7F/BA/wKioL1cq01ShSCK_AAASqlsvdbs901.png "title=" 007. PNG "alt=" Wkiol1cq01shsck_aaasqlsvdbs901.png "/>

# unzip phpmyadmin-4.4.14.1-all-languages.zip# MV Phpmyadmin-4.4.14.1-all-languages PMA

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/7F/BA/wKioL1cq09CzT6ZhAAAUViNXOxk695.png "title=" 008. PNG "alt=" Wkiol1cq09czt6zhaaauvinxoxk695.png "/>

# CD pma/# CP config.sample.inc.php config.inc.php #openssl rand-base64 cvvbs1qfe81b7b7nv9njunghsag# vim conf        ig.inc.php $cfg [' blowfish_secret '] = ' cvvbs1qfe81b7b7nv9njunghsag '; $cfg [' Servers '] [$i] [' host '] = ' 172.18.12.9 ';
#systemctl Restart Php-fpm#systemctl Restart httpd

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/7F/BE/wKiom1cq93qChKyJAAAd4sJXM4M498.png "title=" 013. PNG "alt=" Wkiom1cq93qchkyjaaad4sjxm4m498.png "/>

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/7F/BB/wKioL1cq-Gjh180OAAB346nw6I4114.png "title=" 012. PNG "alt=" Wkiol1cq-gjh180oaab346nw6i4114.png "/>

4.2 Configuring the WordPress app configuration file

# Unzip Wordpress-4.3.1-zh_cn.zip

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/7F/BE/wKiom1cq-C7hveJ6AAAghyswl_M066.png "title=" 014. PNG "alt=" Wkiom1cq-c7hvej6aaaghyswl_m066.png "/>

# CD wordpress/# CP wp-config-sample.php wp-config.php# vim wp-config.php

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/7F/BE/wKiom1cq--fyDtRPAAApAT338W0939.png "title=" 015. PNG "alt=" Wkiom1cq--fydtrpaaapat338w0939.png "/>

# httpd-t# Scp-r/web/php/* [email protected]:/web/php/#为了保证php-fpm and httpd directory site with the same file # Systemctl restart httpd

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/7F/BC/wKioL1cq_SnBsBJcAADqdZJiUvc440.png "title=" 016. PNG "alt=" Wkiol1cq_snbsbjcaadqdzjiuvc440.png "/>

Third, configure the PHP-FPM host

# yum Install php-fpm-y# yum install Php-mbstring-y#yum install php-mysql-y# vim/etc/php-fpm.d/www.conf Listen = 17 2.18.12.8:9000 listen.allowed_clients = 172.18.12.7

Iv. installation of XCache for acceleration

1. Stress testing

# ab-n 300-c http://dy.wordpress/index.php


650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/7F/BE/wKiom1cq_jCBi1fvAAAvFxgMPrE664.png "title=" 018. PNG "alt=" Wkiom1cq_jcbi1fvaaavfxgmpre664.png "/>

2. Installing XCache

Yum Groupinstall "Development tools" "Server platfrom develpment" Yum install php-devel-y phpize./configure--enable-x Cache--with-php-config=/usr/bin/php-config Make&&make INSTALLCP xcache.ini/etc/php.d/systemctl Reload php-fpm

3. Repeat the pressure test

]# ab-n 300-c http://dy.wordpress/index.php


650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/7F/BC/wKioL1crCMui9ke-AAAuRJTG8Gs031.png "title=" 019. PNG "alt=" Wkiol1crcmui9ke-aaaurjtg8gs031.png "/>

It can be seen from the diagram that the performance of the XCache is significantly improved after installation.














This article is from the "11243407" blog, please be sure to keep this source http://11253407.blog.51cto.com/11243407/1770488

Lamp deployment application based on fastcgi separation

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.