Install httpd, PHP-FPM, MariaDB on three hosts separately

Source: Internet
Author: User
Tags fpm install php install wordpress phpmyadmin

The IP of the 1.A host is the IP of the 172.16.25182.,B host is the IP of the 172.16.251.154,c host is eth1 172.16.254.35. 1. Install httpd, PHP-FPM, MariaDB on three hosts on a, B and C respectively.

(1) Install httpd on Host a

~]# Yum install-y httpd

(2) Install PHP-FPM on Host B

~]# Yum install-y php-fpm php-mysql

(3) Install the MARIADB on the C host

~]# Yum install-y mariadb-server

2. Edit the configuration file for Host B/etc/php-fpm.d/www.conf and restart the PHP-FPM service:

Listen = 172.16.251.154:9000

Listen.backlog =-1

Listen.allowed_clients = 172.16.251.82

PM = dynamic

Pm.max_children = 50

Pm.start_servers = 5

Pm.min_spare_servers = 5

Pm.max_spare_servers = 35

Pm.max_requests = 500

Php_value[session.save_handler] = files

Php_value[session.save_path] =/var/lib/php/session

You also need to manually create the directory/var/lib/php/session and modify its owner and host group to Apache.

Chown apache.apache/var/lib/php/session


3. Start PHP-FPM

~]# systemctl Start Php-fpm.service


4. Rename/etc/httpd/conf.d/welcome.conf on Host A, then create two FQDN-based virtual hosts www1.magedu.com and www2.magedu.com.

(1) ~]# Mv/etc/httpd/conf.d/welcome.conf{,.bak}

(2) Edit the configuration file of the WWW1 host/etc/httpd/conf.d/www1.conf and reload the HTTPD service:

<virtualhost 172.16.251.82:80>

ServerName www1.magedu.com

Documentroot/data/www1

Proxyrequests OFF

DirectoryIndex index.php

Proxypassmatch ^/(. *\.php) $ fcgi://172.16.251.154:9000/data/www1/$1

<directory "/DATA/WWW1" >

Options None

AllowOverride None

Require all granted

</Directory>

</VirtualHost>

(3) Edit the configuration file of the WWW2 host/etc/httpd/conf.d/www2.conf and reload the HTTPD service:

<virtualhost 172.16.251.82:80>

ServerName www2.magedu.com

Documentroot/data/www2

Proxyrequests OFF

DirectoryIndex index.php

Proxypassmatch ^/(. *\.php) $ fcgi://172.16.251.154:9000/data/www2/$1

<directory "/DATA/WWW1" >

Options None

AllowOverride None

Require all granted

</Directory>

</VirtualHost>


5. Testing

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M00/84/68/wKiom1eQH-CRycLnAAB1agBPPko137.png-wh_500x0-wm_3 -wmp_4-s_3783501945.png "title=" 1.png "alt=" Wkiom1eqh-cryclnaab1agbppko137.png-wh_50 "/>

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/84/68/wKioL1eQH-zz5vwjAAB4twFu_XA704.png-wh_500x0-wm_3 -wmp_4-s_2533944472.png "title=" 2.png "alt=" Wkiol1eqh-zz5vwjaab4twfu_xa704.png-wh_50 "/>


6. Test the PHP-FPM connection to the MARIADB.

(1) Create database TestDB in mariadb, user testuser, password testpasswd.

~]# MySQL

mariadb[(none)]>createdatabase TestDB;

mariadb[(none)]>createuser ' testuser ' @ ' 172.16.%.% ' identified by ' testpasswd ';

mariadb[(None)]>grantall on testdb.* to ' testuser ' @ ' 172.16.%.% ';

mariadb[(None)]>flushprivileges;

(2) on the Host B separately edit/DATA/WWW1 and/data/www2 inside the index.php file test and mariadb connection is normal, the content is as follows:

<?php

$conn = mysql_connect (' 172.16.254.35 ', ' testuesr ', ' testpasswd ');

If ($conn)

echo "OK";

Else

echo "Falure";

?>

(3) test the following on Internet Explorer:

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/84/68/wKioL1eQID-iAf3TAAAzg8cuD6I036.png "title=" 3.png " alt= "Wkiol1eqid-iaf3taaazg8cud6i036.png"/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/84/68/wKiom1eQIEyzjxk7AAAxB0eFrEI673.png "title=" 4.png " alt= "Wkiom1eqieyzjxk7aaaxb0efrei673.png"/>

7. Install WordPress on the host WWW1 for the virtual host.

(1) Unzip WordPress and put it in the/data/www1/directory

~]# Unzipwordpress_4.3.1_zh_cn.zip

(2) Rename the directory under wp-config-sample.php to wp-config.php and edit the following:

~]# mv/data/www1/wp-config-sample.php/data/www1/wp-config.php

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/84/68/wKiom1eQIGrQpGduAAAuWbFJ_ZA727.png "title=" 5.png " alt= "Wkiom1eqigrqpgduaaauwbfj_za727.png"/>

(3) Open the Www1.magedu.com test on the browser.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/84/68/wKioL1eQIIvApztEAACXszedwPU411.png "title=" 6.png " alt= "Wkiol1eqiivapzteaacxszedwpu411.png"/>

8. Install phpMyAdmin for the virtual host WWW2 on Host B.

(1) Unzip the phpMyAdmin and copy it to the/data/www2/directory.

~]# cp-rphpmyadmin-4.4.15.7-all-languages/*/data/www2/

(2) renaming config.sample.inc.php to config.inc.php

~]# MV config.sample.inc.phpconfig.inc.php

(3) Edit the config.inc.php file and populate the Blowfish_secret field with the random code generated by OpenSSL.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/84/68/wKiom1eQILaSWByeAAAL-rls1yU177.png "title=" 7.png " alt= "Wkiom1eqilaswbyeaaal-rls1yu177.png"/>

(4) Edit the config.inc.php file and modify the [' Servers '] [$i] [' Host '] field with the IP address 172.16.254.35.

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/84/68/wKiom1eQINSwc0IXAAAKZuWAp50025.png "title=" 8.png " alt= "Wkiom1eqinswc0ixaaakzuwap50025.png"/>

(5) Open the www2.magedu.com test in the browser.

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/84/68/wKiom1eQIPbjILfUAADodSgmkPE757.png "title=" 9.png " alt= "Wkiom1eqipbjilfuaadodsgmkpe757.png"/>

Install httpd, PHP-FPM, MariaDB on three hosts separately

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.