Rapid construction of lamp in centos7 (separation of the three)
CentOS 7, lamp (php-fpm)
Requirements: (1) the three are separated from three hosts
(2) one virtual host is used to provide phpMyAdmin; and the other virtual host is used to provide wordpress
(3) xcache
1. Preparatory work:
Prepare three servers, which are respectively used to install httpd,php-fpm,mariadb. Configure the network and yum sources, and turn off selinux and firewall
Install and configure the httpd server
1. Install the httpd service
Yum install httpd-y
2. Edit the httpd configuration file and create 2 virtual hosts, and create a new / etc/httpd/conf.d/vhost.conf
DocumentRoot / var/www/html/
ServerName www.blog.com
ProxyRequests off
ProxyPassMatch ^ / (. *\ .php) $fcgi://172.18.24.11:9000/var/www/html/$1
DocumentRoot / var/www/html/
ServerName www.mysql.com
ProxyRequests off
ProxyPassMatch ^ / (. *\ .php) $fcgi://172.18.24.11:9000/var/www/html/$1
3. Configure php-fpm service
1. Install the php-fpm,php-mbstring,php-mysql service
Yum install php-fmp php-mbstring,php-mysql-y
2. Edit / etc/php-fpm.d/www.conf and modify the following:
Listen = 172.18.24.11 9000
Listen.allowed_clients = 172.18.24.10
3. Create / var/www/html/
Mldir-pv / var/www/html
4. Put wordpress and phpmyadmin under this file directory
4. Install and configure mariadb service
1. Install mariadb on the C server
Yum install mariadb-server
2. Start the mariadb service and enter the mysql database
Systemctl start mariadb.service
Create a database wp
Mysql > CREATE DATABASE wp
Add user wpuser and grant remote login permission
GRANT ALL ON *. * TO wpuser@'%.%' IDENTIFIED BY 'wppasswd'
5. Configure wordpress
1. First, cp configuration file
Cp wp-config-sample.php wp-config.php
2. Then edit the configuration file as follows:
/ / * * MySQL settings-specific information comes from the host you are using * * / /
/ * * name of WordPress database * /
Define ('DB_NAME',' wp')
/ * * MySQL database user name * /
Define ('DB_USER',' wpuser')
/ * * MySQL database password * /
Define ('DB_PASSWORD',' wppasswd')
/ * * MySQL host * /
Define ('DB_HOST',' 172.18.24.11')
Configure the configuration file of phpmyadmin
1. Cp the configuration file
Cp config.sample.inc.php config.inc.php
2. Then edit the configuration file as follows:
You only need to fill in a string of random numbers at the end of the string and you can get $cfg ['blowfish_secret'] =' A7kNC35a2OFOsQuan; / * YOU MUST FILL IN THIS FOR COOKIE AUTH! * /
Note: it needs to be on the server that copies wordpress and phpmyadmin to httpd.
VI. Compile and install xcache
The specific steps are as follows:
How to compile and install xache:
# yum install php-devel
# cd xcache-3.2.0
# phpize
#. / configure-enable-xcache-with-php-config=/usr/bin/php-config
# make & & make install
# cp xcache.ini / etc/php.d/
Use php-v to check whether xcache is installed successfully
At this point, the installation is successful.