标签:网页 web hosts php-fpm nfs共享 har lamp nfs-utils zone
web服务器(LAMP)通过DNS轮询功能和nfs共享实现负载均衡,部署discuz论坛拓扑思路:
服务器1:mariadb+nfs;172.20.120.40
服务器2:apache+php-fpm;172.20.120.41
服务器3:apache+bind;172.20.120.42
服务器1:mariadb+nfs;172.20.120.40
部署nfs共享;分别使用lvm当做数据库目录/mydata、网页文件目录/vhosts;
/dev/vg01/mydata /mydata xfs defaults 0 0
/dev/vg01/myhtdoc /vhosts xfs defaults 0 0
/vhosts 172.20.120.41(rw,no_root_squash) 172.20.120.42(rw,no_root_squash)
innodb_file_per_table = on
skip_name_resolv = on
datadir = /mydata/data
下载discuz并上传网页文件到/vhosts/web1目录下
服务器2:apache+php-fpm;172.20.120.41
172.20.120.40:/vhosts /vhosts nfs defaults,_netdev 0 0
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>
listen = 172.20.120.41:9000
listen.allowed_clients = 172.20.120.41,172.20.120.42
服务器3:apache+bind;172.20.120.42
172.20.120.40:/vhosts /vhosts nfs defaults,_netdev 0 0
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>
options {
listen-on port 53 { 172.20.120.42; };
// listen-on-v6 port 53 { ::1; };
allow-query { 172.20.120.0/16; };
zone "lewis.com" IN {
type master;
file "lewis.com.zone";
allow-update { none; };
};
$TTL 1D
@ IN SOA ns.lewis.com. root@localhost (
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
web服务器(LAMP)通过DNS轮询功能和nfs共享实现负载均衡
标签:网页 web hosts php-fpm nfs共享 har lamp nfs-utils zone
原文地址:http://blog.51cto.com/11476314/2159913