Web server (LAMP) load balancing via DNS polling and NFS sharing

Source: Internet
Author: User
Tags fpm

Web server (LAMP) load balancing via DNS polling and NFS sharing, deploying Discuz forum

Topology ideas:

Server 1:mariadb+nfs;172.20.120.40

Server 2:apache+php-fpm;172.20.120.41

Server 3:apache+bind;172.20.120.42

Server 1:mariadb+nfs;172.20.120.40

Yum Install Mariadb-server Nfs-utils

Deploy NFS Share, use LVM as database directory/mydata, web file directory/vhosts respectively;

Yum install mariadb-server nfs-utils-yfdisk-l/dev/sdapartx-a/dev/sdapvcreate/dev/sda3vgcreate vg01/dev/sda3lvcreat E-l 8g-n mydata vg01lvcreate-l 8g-n myhtdoc vg01mkfs-t xfs/dev/vg01/mydatamkfs-t Xfs/dev/vg01/myhtdocmkdir/mydatam Kdir/vhostsvim/etc/fstab Add the following

/dev/vg01/mydata/mydata XFS Defaults 0 0
/dev/vg01/myhtdoc/vhosts XFS Defaults 0 0

Mount-avim/etc/exports

/vhosts 172.20.120.41 (Rw,no_root_squash) 172.20.120.42 (Rw,no_root_squash)

Cp/usr/share/mysql/my-large.cnf/etc/my.cnfvim/etc/my.cnf

Innodb_file_per_table = On
Skip_name_resolv = On
DataDir =/mydata/data

Mkdir-pv/mydata/datachown Mysql:mysql/mydata/datasystemctl Enable NFS Mariadbsystemctl start NFS Mariadbmysql_secure_ Installation

Download Discuz and upload the Web file to the/vhosts/web1 directory

Server 2:apache+php-fpm;172.20.120.41

Yum install httpd php-fpm php-mysql nfs-utils-yvim/etc/fstab

172.20.120.40:/vhosts/vhosts NFS Defaults,_netdev 0 0

Mount-avim/etc/httpd/conf/htttpd.conf

AddType application/x-httpd-php. php
AddType Application/x-httpd-php-source. Phps

DirectoryIndex index.php index.html

<virtualhost :80>
ServerName bbs.lewis.com
Documentroot/vhosts/web1
Proxyrequests off
Proxypassmatch ^/(.
. PHP (/.*)?) $ fcgi://172.20.120.41:9000/vhosts/web1/$1
<directory "/vhosts" >
Require all granted
Options None
allowoverride None
</Directory>
</VirtualHost>

Vim/etc/php-fpm.d/www.conf

Listen = 172.20.120.41:9000

Listen.allowed_clients = 172.20.120.41,172.20.120.42

Systemctl enable httpd php-fpmsystemctl start httpd php-fpm

Server 3:apache+bind;172.20.120.42

Yum Install httpd bind Nfs-utils-yvim/etc/fstab

172.20.120.40:/vhosts/vhosts NFS Defaults,_netdev 0 0

Mount-avim/etc/httpd/conf/htttpd.conf

AddType application/x-httpd-php. php
AddType Application/x-httpd-php-source. Phps

DirectoryIndex index.php index.html

<virtualhost :80>
ServerName bbs.lewis.com
Documentroot/vhosts/web1
Proxyrequests off
Proxypassmatch ^/(.
. PHP (/.*)?) $ fcgi://172.20.120.41:9000/vhosts/web1/$1
<directory "/vhosts" >
Require all granted
Options None
allowoverride None
</Directory>
</VirtualHost>

Vim/etc/named.conf

Options {
Listen-on Port 53 {172.20.120.42;};
Listen-on-v6 Port 53 {:: 1;};
allow-query {172.20.120.0/16;};

Vim/etc/named.rfc1912.zones

Zone "Lewis.com" in {
Type master;
File "Lewis.com.zone";
allow-update {none;};
};

Vim/var/named/lewis.com.zone

$TTL 1D
@ in SOA ns.lewis.com. [Email protected] (
2018060501
2H
20M
1W
1D
)
In NS ns.lewis.com.
NS in A 172.20.120.42
BBS in A 172.20.120.41
BBS in A 172.20.120.42
Lewis.com. In A 172.20.120.42
Lewis.com. In A 172.20.120.41

Systemctl enable httpd namedsystemctl start httpd named

Web server (LAMP) load balancing via DNS polling and NFS sharing

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.