haproxy+lamp+nginx(处理静态)

haproxy+lamp+nginx(处理静态)

三台虚拟机:
192.168.136.15:haproxy
192.168.136.16:lamp
192.168.136.17:nginx
安装包:tinyshopV2.5_data.zip
nginx-1.18.0.tar.gz
yum安装的一切依赖包都是用网络源安装。

15:
yum -y install haproxy

vim /etc/haproxy/haproxy.cfg
#---------------------------------------------------------------------
#main frontend which proxys to the backends
#---------------------------------------------------------------------
frontend main *:80
#acl url_static path_beg -i /static /images /javascript /stylesheets
acl url_static path_end -i .jpg .gif .png .css .js
use_backend static if url_static
default_backend app
#---------------------------------------------------------------------
#static backend for serving up images, stylesheets and such
#---------------------------------------------------------------------
backend static
balance roundrobin
server static 192.168.136.17:80 check
#---------------------------------------------------------------------
#round robin balancing between the various backends
#---------------------------------------------------------------------
backend app
balance roundrobin
server app1 192.168.136.16:80 check

systemctl start haproxy

16:
yum -y install httpd php php-gd php-mysql mariadb mariadb-server
systemctl start mariadb
systemctl start httpd
yum -y install unzip
cd /var/www/html
ls
unzip tinyshopV2.5_data.zip
chmod -R 777 .*
scp -r data/ [email protected]:/usr/local/nginx/html/
systemctl restart httpd
cd /var/www/html
rm -rf data

17:
cd
yum -y install gcc gcc-c++ pcre-devel openssl-devel
tar zxf nginx-1.18.0.tar.gz
cd nginx-1.18.0/
./configure && make && make install
/usr/local/nginx/sbin/nginx

猜你喜欢

转载自blog.csdn.net/youchaoXu/article/details/111648784
今日推荐