The purpose of this experiment is to set up lamp to deploy in three hosts: one to deploy HTTP, one to deploy PHP-FPM, and one to deploy MARIADB. Prepare three hosts before deployment.
The client sends the request process:
when a client sends a static resource request, HTTPD handles it itself. When a client sends a request for a dynamic resource. HTTPD itself as a reverse proxy, sends the request to the PHP-FPM host for processing, and when the request is sent to PHP-FPM, it communicates with the mariadb when it is started (php-mysql) through MySQL and, of course, authorizes remote logins in advance.
First, the host that deploys the MARIADB
1. Installing MARIADB
Yum-y Install MariaDB
2. Start MARIADB and run the Security Wizard
Systemctl Start Mariadb.service
Mysql_secure_installation
3. Log in to MARIADB, and create a database, account, password dedicated to phpMyAdmin and WordPress, and authorize Telnet
Mysql-uroot-p
CREATE DATABASE phpdb;
CREATE DATABASE wordphp;
GRANT all on phpdb.* to ' phpuser ' @ ' 172.18.%.% ' identified by ' PHP ';
GRANT all on worddb.* to ' worduser ' @ ' 172.18.%.% ' identified by ' word ';
FLUSH privileges;
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/7F/63/wKiom1ccwiiygenpAABsc2LGJlQ960.png "title=" 2.PNG " alt= "Wkiom1ccwiiygenpaabsc2lgjlq960.png" width= "650" style= "Padding:0px;margin:0px;vertical-align:top;border: none; "/>
Ii. Deployment of PHP-FPM
1. Install PHP-FPM, Php-mysql
Yum-y Install PHP-FPM
Yum-y Install Php-mysql
2. Modify the PHP-FPM configuration file/etc/php-fpm.d/www.conf
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/7F/7F/wKioL1cgwaPAPRbEAABGonLsDl0112.png "title=" fpm-2. PNG "alt=" Wkiol1cgwapaprbeaabgonlsdl0112.png "/>
Listen modified to native Ip+port
The listen.allowed_clients is set to the IP of the HTTP host.
3. Create a new directory to place phpMyAdmin and WordPress
Mkdir-pv/test/{myadmin,word}
4. Download and unzip the WordPress archive and go to the WordPress directory and copy wp-config-sample.php to wp-config.php.
Unzip Wordpress-4.3.1-zh_cn.zip
CP wp-config-sample.php wp-config.php
5. Modify the database name, account number, password, connected IP 650) this.width=650 in the wp-config.php; "Src=" http://s2.51cto.com/wyfs02/M00/7F/61/ Wkiol1ccxnkdq-nraaaqgkc4vvo501.png "title=" 3.PNG "alt=" Wkiol1ccxnkdq-nraaaqgkc4vvo501.png "style=" padding:0px; Margin:0px;vertical-align:top;border:none; "/>
6. Download and unzip the phpMyAdmin compressed package and link phpMyAdmin to PMA
config.sample.inc.php modified to config.inc.php
LN-SV phpmyadmin-4.4.14.1-all-languages PMA
CP config.sample.inc.php config.inc.php
7. Generate random numbers to fill in config.inc.php Blowfish_secret and remote database host addresses
OpenSSL rand-base64 15
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/7F/7F/wKioL1cgwn7x41_1AABGonLsDl0751.png "title=" fpm-2. PNG "alt=" Wkiol1cgwn7x41_1aabgonlsdl0751.png "/>
Host is the IP ground for httpd
8. Installing X-cache
Yum-y Install Php-xcache
Iii. Deployment of HTTPD
1. Installing httpd
Yum-y Install httpd
2. Modify the DocumentRoot comment in the config file/etc/httpd/conf/httpd.conf file (start with #)
#DocumentRoot "/var/www/html"
3. Create two directories dedicated to static Web pages.
Mkdir-pv/test/{myadmin,word}
4. Edit the index.html in the directory where the static pages are stored
5. Create two virtual hosts, and in/etc/httpd/conf.d/create a file that ends in. conf, making the following edits
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/7F/7F/wKioL1cgweGhgRl2AABkNaRfKHk898.png "title=" fpm-3. PNG "alt=" Wkiol1cgweghgrl2aabknarfkhk898.png "/>
Proxyrequests represents the forward proxy, which is closed when the httpd as a reverse proxy
The proxypassmatch indicates that a matching. PHP application is destined for the PHP-FPM host.
Iv. Start-up service
Systemctl Start Httpd.service
Systemctl Start Php-fpm.service
V. Modify the Hosts file,
The domain name that we are accessing directly points to our virtual host. here take WinDOS as an example
Add a virtual host IP and domain name at C:\Windows\System32\drivers\etc\host at the end of the file
172.18.254.123 www.myadmin.com
172.18.254.123 www.word.com
Open the browser and type the address. Test results!
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/7F/81/wKiom1cgwSTw-2N0AACDHtW5SAE064.png "style=" float: none; "Title=" fpm-4. PNG "alt=" Wkiom1cgwstw-2n0aacdhtw5sae064.png "/>
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/7F/7F/wKioL1cgwe_zLJrAAACvEhyJXR4321.png "style=" float: none; "Title=" fpm-5. PNG "alt=" Wkiol1cgwe_zljraaacvehyjxr4321.png "/>
Lamp deployed on three hosts