CentOS 7, lamp (PHP-FPM)

Source: Internet
Author: User
Tags fpm install wordpress

CentOS 7, lamp (PHP-FPM);
Requirements: (1) Three separate from the host;
(2) A virtual host is used to provide phpmyadmin; Another virtual host is used to provide WordPress;
(3) XCache


Lab Environment:

Host
System
IP Address
Deployment Services
A
CentOS 7
192.168.2.110 apache2.4
B
CentOS 7
192.168.2.111
Mariadb
C
CentOS 7
192.168.2.112
php-fpm

I. Deployment of Apache on Host a

(1) Install the HTTPD service on Host 1

[email protected] ~]# Yum install httpd-y

(2) Check whether the fcgi module is loaded

[Email protected] ~]# Httpd-m | grep fcgi proxy_fcgi_module (shared)

(3) Creating a configuration file

[Email protected] ~]# Vim/etc/httpd/conf.d/fcgi.confdirectoryindex index.phpproxyrequests off

(4) Create a virtual host configuration file

[[email protected] ~]# vim /etc/httpd/conf.d/vhosts.conf<virtualhost  192.168.2.110:80>        documentroot /www/htdocs/web1/pma         ServerName pma.mylinuxops.com         proxypassmatch ^/(. *\.php) $ fcgi://192.168.2.112:9000/www/htdocs/web1/pma/$1         <Directory /www/htdocs/web1/pma>                 Options none                 allowoverride none                 Require  all granted        </directory></virtualhost>< virtualhost 192.168.2.110:80>        DocumentRoot /www/htdocs/web2/wordpress         ServerName wp.mylinuxops.com         proxypassmatch ^/(. *\.php) $ fcgi://192.168.2.112:9000/www/htdocs/web2/wordpress/$1         <Directory /www/htdocs/web2/wordpress>                 Options none                 AllowOverRide none                 Require all  Granted        </directory></virtualhost>

(5) Start httpd service

[Email protected] ~]# systemctl start httpd

Second, deploy MARIADB on Host B

(1) Installation Mariadb-server

[email protected] ~]# Yum install-y mariadb-server

(2) Start mariadb

[Email protected] ~]# systemctl start mariadb

(3) Implement security environment deployment to MARIADB

[[Email protected] ~]# mysql_secure_installationnote: running all parts of  THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB       servers in production use!  please read each step carefully ! In order to log into mariadb to secure it, we ' ll need  The currentpassword for the root user.  if you ' ve just  Installed mariadb, andyou haven ' t set the root password yet, the  password will be blank,so you should just press enter here. enter current password for root  (enter for none): OK, successfully  used password, moving on ... Setting the root password ensures that nobody can&nBsp;log into the mariadbroot user without the proper authorisation. set root password? [y/n] ynew password:re-enter new password:password  updated successfully! Reloading privilege tables.  ... success! by default, a mariadb installation has an anonymous user,  allowing anyoneto log into mariadb without having to have a  user account created forthem.  this is intended only for  Testing, and to make the installationgo a bit smoother.  you  should remove them before moving into aproduction environment. remove anonymous users? [y/n] y ... success! normally, root should only be allowed to connect from  ' localhost '.   thisensures that someone cannot guess at the  root password from the network. Disallow root login remotely? [y/n] n ... skipping. by default, mariadb comes with a database named  ' Test '  that  anyone canaccess.  this is also intended only for testing,  And should be removedbefore moving into a production environment. Remove test database and access to it? [y/n] n ... skipping. Reloading the privilege tables will ensure that all changes made  so farwill take effect immediately. reload privilege tables now? [y/n] y ... success! Cleaning up ... All done!  if you ' VE&NBsp;completed all of the above steps, your mariadbinstallation should  now be secure. thanks for using mariadb!

     (4) Create users and databases required for WordPress and PMA

[[email protected] ~]# mysql -uroot - Prootwelcome to the mariadb monitor.  commands end with ; or  \g.your mariadb connection id is 8server version: 5.5.56-mariadb  MariaDB ServerCopyright  (c)  2000, 2017, oracle, mariadb corporation  ab and others. type  ' help; '  or  ' \h '  for help. Type  ' \c '  to clear the current input  statement. mariadb [(None)]> create database wpdb; query ok, 1 row affected  (0.00 sec) mariadb [(none)]> USE wpdb ;D atabase changedmariadb [wpdb]> grant all on wpdb to  ' wpuser ' @ ' 192.168.2.112 '  IDENTIFIED BY  ' wpuser '; query ok, 0 rows affected  (0.00 sec) 

Third, deploy PHP-FPM on Host C

(1) Install PHP-FPM php-mysql php-mbstring

[email protected] ~]# Yum install php-fpm php-mysql php-mbstring-y

(2) Modify the PHP-FPM configuration file

[Email protected] ~]# Vim/etc/php-fpm.d/www.conflisten = 192.168.2.112:9000listen.allowed_clients = 192.168.2.110

(3) Create/var/lib/php/session directory

[[email protected] ~]# mkdir-pv/var/lib/php/session default/var/lib/php/session directory does not exist, so we want to create this directory [[email protected] ~]# Chow n Apache:apache/var/lib/php/session modified belong to the main group of Apache

(4) Start PHP-FPM

[Email protected] ~]# systemctl start php-fpm


Iv. installation and deployment of applications

> Note: Because this trial was deployed separately from Apache and PHP-FPM, the dynamic resource requests accessed by the user go directly to the [192.168.2.112 PHP-FPM] host, so our site Directory also needs to be deployed to the [192.168.2.112 php-fpm ] on the host, in other words, the site directory is in [192.168. 2.112 php-fpm] and [192.168.2.110 Apache] Each one, so how do we do it. Simply push to [192.168.2.112 PHP-FPM] After the [192.168.2.110 Apache] deployment is complete. On the host

(1) Create a site directory on host C

[[email protected] ~]# Mkdir-pv/www/htdocs/web{1,2}mkdir: Created directory "/www" mkdir: Directory Created "/www/htdocs" mkdir: Directory Created "/www/htdo Cs/web1 "mkdir: Directory Created"/WWW/HTDOCS/WEB2 "

(2) Installing PMA

1. Unzip the PMA file [[email protected] ~]# unzip phpmyadmin-4.0.10.20-all-languages.zip2. Copy the file to the site directory [[email protected] ~]# cp-a Phpmyadmin-4.0.10.20-all-languages/www/htdocs/web1/phpmyadmin-4.0.10.20-all-languages3. Creating a linked file [email protected] ~]# Cd/www/htdocs/web1/[[email protected] web1]# ln-sv phpmyadmin-4.0.10.20-all-languages PMA "PMA", phpMyAdmin-4 .0.10.20-all-languages "4. Modify the configuration file [[email protected] web1]# CD Pma[[email protected] pma]# CP config.sample.inc.php Config.inc.php[[email protected] pma]# vim config.inc.php$cfg[' blowfish_secret '] = ' a8b7c6d '; /* Must FILL in the this for COOKIE auth! */$cfg [' Servers '] [$i] [' host '] = ' 192.168.2.111 ';

(3) Install WordPress

1. Unzip Wordpress[[email protected] ~]# tar-xf wordpress-4.9.4-zh_cn.tar.gz2. Copy files to the site directory [[email protected] ~]# cp-a Wordpress/www/htdocs/web2/[[email protected] ~]# CD/WWW/HTDOCS/WEB2/WORDPRESS/3. modifying configuration files [email protected] WordPress] # CP wp-config-sample.php Wp-config.php[[email protected] wordpress]# vim wp-config.phpdefine (' db_name ', ' wpdb '); Define (' Db_user ', ' Wpuser ');d efine (' Db_password ', ' Wpuser ');d efine (' db_host ', ' 192.168.2.111 ');

(4) Push the/WWW directory on Host C to host a

[Email protected] wordpress]# scp-rp/www [email protected]:/www

(5) Connect PMA and WordPress

Installation Successful


Wu, XCache

[email protected] wordpress]# Yum install php-xcache-y








CentOS 7, lamp (PHP-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.