The distributed implementation of lamp--install WordPress, phpMyAdmin

Source: Internet
Author: User
Tags mysql host install wordpress phpmyadmin wordpress database

Title: Deploy httpd, PHP-FPM, mariadb with three CentOS 7 hosts respectively


First 192.168.10.101--httpd second 192.168.10.102--php-fpm third 192.168.10.103--mariadb


The SELinux and Iptables are closed before starting to facilitate testing.

# iptables-f# Setenforce 0


The configuration starts from the first one.

#安装httpd

[Email protected] ~]# yum-y install httpd


#配置虚拟主机

Directoryindex index.php<virtualhost *:80>    servername www.a.com     #  Configure the first virtual host     DocumentRoot /apps/vhosts/a.com      proxyrequests off    proxypassmatch ^/(. *\.php) $ fcgi:// 192.168.10.102:9000/apps/vhosts/a.com/$1    <directory  "/apps/vhosts/a.com" >         Options None         allowoverride none        require all granted     </Directory></VirtualHost><VirtualHost *:80>     ServerName www.b.net    #  Configuring the second virtual host     documentroot   "/apps/vhosts/b.net"     proxyrequests off    proxypassmatch  ^/(. *\.php) $ fcgi://192.168.10.102:9000/apps/vhosts/b.net/$1    <directory  "/apps/vhosts/b.net" >         Options None         allowoverride none        require all granted     </Directory></VirtualHost>


#创建资源映射目录

[[email protected] ~]# Mkdir-pv/apps/vhosts/{a.com,b.net}


#注释掉中心主机的文档根路径

#DocumentRoot "/var/www/html"


#检查语法

[[email protected] ~]# Httpd-tsyntax OK


#启动httpd服务进程

[Email protected] ~]# systemctl start Httpd.service:::* [Email protected] ~]# SS-TNL | grep 80LISTEN 0::: +:::*


#创建静态资源文件, as a test

[Email protected] ~]# vim/apps/vhosts/a.com/index.html


#修改hosts文件

# vim/etc/hosts192.168.10.101 www.a.com www.b.net www.c.org


#确保httpd有装载fcgi模块

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


Configure a third host.

#安装数据库

[Email protected] ~]# yum-y install Mariadb-server


#启动起来

[[email protected] ~]# systemctl start mariadb.service[[email protected] ~]# SS-TNL | grep 3306LISTEN 0 *:3306 *:*


#授权用户及创建数据库

[[email protected] ~]# mysqlmariadb [(none)]> GRANT all on wpdb.* to [e-mail protected] ' 192.168.%.% ' identified by ' Wppa SS '; MariaDB [(None)]> FLUSH privileges; MariaDB [(None)]> CREATE DATABASE wpdb;


Configure the second host.

#要安装php-FPM and Php-mysql

[Email protected] ~]# yum-y install PHP-FPM php-mysql


#修改配置文件

[[email protected] ~]# Vim/etc/php-fpm.d/www.conflisten = 192.168.10.102:9000 # listening on the local network interface listen.allowed_clients = 19 2.168.10.101 # allow the first host to connect # other default invariant


#创建资源映射目录

[[email protected] ~]# Mkdir-pv/apps/vhosts/{a.com,b.net}


#写入php连接数据库的测试代码


#启动php-FPM Service Process

[[email protected] ~]# systemctl start php-fpm[[email protected] ~]# SS-TNL | grep 9000LISTEN 0 192.168.10.102:9000 *:*


#安装php-xcache Accelerator

[Email protected] ~]# yum-y install Php-xcache


#测试没有问题之后, you can now start deploying WordPress and phpMyAdmin programs on the second host.

#首先搞定WordPress

#从官网下载WordPress压缩包

[Email protected] ~]# wget https://cn.wordpress.org/wordpress-4.7.4-zh_CN.zip


#下载后解压, and move to the resource map directory path

[Email protected] ~]# unzip Wordpress-4.7.4-zh_cn.zip[[email protected] ~]# mv wordpress/apps/vhosts/a.com


#cd进该目录, and copy the sample configuration file wp-config-sample.php to wp-config.php

[[email protected] ~]# Cd/apps/vhosts/a.com/wordpress/[[email protected] wordpress]# CP wp-config-sample.php wp-config.php


#修改配置文件wp-config.php, the database information that needs to be modified here comes from the database name, user name, and password that you just created on the third host.

[[email protected] wordpress]# VIM wp-config.php//* * MySQL Settings-specific information from the host you are using * *///** the name of the WordPress database */define (' db_name    ', ' wpdb ');    # Modify the database name, use the database you just created on the third host/** MySQL database username */define (' db_user ', ' wpuser ');    # Modify user name/** MySQL database password */define (' Db_password ', ' wppass ');    # Change Password/** mysql host */define (' Db_host ', ' 192.168.10.103 '); # The MySQL host here points to the third host


#至此WordPress就配置完成了, you need to overload the PHP-FPM configuration file

[Email protected] ~]# Systemctl Reload Php-fpm.service


#测试WordPress

#使用浏览器输入URL为http://www.a.com/wordpress

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M02/97/86/wKioL1kvcQ6TFLgaAABGIrIAXCA322.png "title=" 1.PNG "alt=" Wkiol1kvcq6tflgaaabgiriaxca322.png "/>

#但是输入http://www.a.com/wordpress is able to access, has ruled out the impact of DirectoryIndex, So how to enable users to access the virtual host www.a.com WordPress directory when automatically return to index.php it?


#问题解决思路: It is possible to create/apps/vhosts/a.com/wordpress on the first host, although the dynamic resources under WordPress are stored on the second PHP-FPM host, while the first httpd host is used to store static resources , but it may still be necessary to have wordpress this empty directory on the first host.

[Email protected] ~]# mkdir/apps/vhosts/a.com/wordpress


#再使用浏览器打开, the URL entered is still http://www.a.com/wordpress

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M02/97/86/wKioL1kvcr-RWBlHAAC8lvorvNw928.png "title=" 1212. PNG "alt=" Wkiol1kvcr-rwblhaac8lvorvnw928.png "/>

#可以发现, the browser will be redirected to this page, fill in the basic blog personal information, fill out and click Install wordpress

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/97/85/wKiom1kvc1_BqgiVAAAck-i8mgs671.png "title=" 2.PNG "alt=" Wkiom1kvc1_bqgivaaack-i8mgs671.png "/>

#安装后点击登录

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M00/97/85/wKiom1kvc4mRnNKBAAAqHJZVfqc048.png "title=" 3.PNG "alt=" Wkiom1kvc4mrnnkbaaaqhjzvfqc048.png "/>

#但是点击登录后出现如下页面

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M01/97/86/wKioL1kvc7aSRu0TAABKNp59UBE612.png "title=" 4.PNG "alt=" Wkiol1kvc7asru0taabknp59ube612.png "/>

#和刚才一样的解决思路, create the Wp-admin directory under the WordPress directory in the www.a.com site directory on the virtual host on the first host

[Email protected] ~]# mkdir/apps/vhosts/a.com/wordpress/wp-admin


#再次登录wordpress

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M01/97/85/wKiom1kvdGbiO4u0AAGfx7GMmiE368.png "style=" float : none; "title=" 5.PNG "alt=" Wkiom1kvdgbio4u0aagfx7gmmie368.png "/>

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M02/97/85/wKiom1kvdHPhO37oABhi40uT7SE864.png "style=" float : none; "title=" blog. PNG "alt=" Wkiom1kvdhpho37oabhi40ut7se864.png "/>

#至此Wordpress安装并测试成功, then take care of the 2nd virtual host on the first console phpMyAdmin

#在第二台主机上下载phpMyAdmin压缩包

[Email protected] ~]# wget https://files.phpmyadmin.net/phpMyAdmin/4.0.10.20/phpMyAdmin-4.0.10.20-all-languages.zip


#解压后并移至虚拟主机www. b.NET under the Site Directory

[Email protected] ~]# unzip Phpmyadmin-4.0.10.20-all-languages.zip[[email protected] ~]# MV Phpmyadmin-4.0.10.20-all-languages/apps/vhosts/b.net[[email protected] ~]# Cd/apps/vhosts/b.net[[email protected] b.net]# LN-SV phpmyadmin-4.0.10.20-all-languages PMA # Create a link directory PMA ' PMA ', ' phpmyadmin-4.0.10.20-all-languages '


#cd进链接目录pma, copy the sample configuration file config.sample.inc.php to config.inc.php and modify the

[[Email protected] b.net]# CD Pma/[[email protected] pma]# CP config.sample.inc.php Config.inc.php[[email protected] PMA] # vim config.inc.php# mainly modifies these two configurations $cfg[' blowfish_secret '] = ' ohtcfa/tpaw47b+cf1be '; /* Must FILL in the this for COOKIE auth!    */# above two single quotes in the middle plus a random code for communication encryption, random code can be generated by OpenSSL rand-base64 15 $cfg[' Servers ' [$i] [' host '] = ' 192.168.10.103 '; # This point points to the address of the third host (that is, the database host)


#现在第2台虚拟主机的配置基本完成, overloading the PHP-FPM service process

[Email protected] ~]# Systemctl Reload Php-fpm.service


#在第三台主机上授权用户

[[email protected] ~]# mysqlmariadb [(none)]> GRANT all on * * to [e-mail protected] ' 192.168.%.% ' identified by ' Pmapass ‘; MariaDB [(None)]> FLUSH privileges;


#现在测试phpMyAdmin

#打开浏览器, enter the URL as HTTP://WWW.B.NET/PMA, shown below

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M02/97/87/wKiom1kvfF3iOTKlAABf2TP2ZNE707.png "title=" 6.PNG "alt=" Wkiom1kvff3iotklaabf2tp2zne707.png "/>

#解决思路: The same exclusion is affected by the DirectoryIndex, although dynamic resources should be stored on the second host, but the user access to the directory name on the second host in the first host's virtual host Site Directory also needs to exist

[Email protected] ~]# MKDIR/APPS/VHOSTS/B.NET/PMA


#再次访问http://WWW.B.NET/PMA, shown below

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M01/97/88/wKioL1kvftCgqs6YAADb9NqqZho631.png "title=" 7.PNG "alt=" Wkiol1kvftcgqs6yaadb9nqqzho631.png "/> #重新生成随机码并修改到配置文件config. inc.php, re-access, fill in the database user name and password you just authorized on the third host to log in

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M01/97/87/wKiom1kvgCXTqnRZAABNPGVhzuE570.png "title=" 8.PNG "alt=" Wkiom1kvgcxtqnrzaabnpgvhzue570.png "/>

can be used normally.








This article is from the "tab" blog, so be sure to keep this source http://xuweitao.blog.51cto.com/11761672/1931266

The distributed implementation of lamp--install WordPress, phpMyAdmin

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.