部署wordpresss,实现基于proxy的nginx负载均衡

部署wordpresss,实现基于proxy的nginx负载均衡

环境:

192.168.227.12:nginx、php、mysql

192.168.227.13:nginx、php、mysql

192.168.227.15:nginx-proxy前端代理

1.部署12、13服务器后端nginx服务器

yum install nginx -y

2.部署12、13服务器的php服务和MySQL服务

yum install php php-fpm php-devel php-mysql -y

yum install mariadb mariadb-server mariadb-devel

3.上传wordpress网站代码

tar xf wordpress-4.9.4-zh_CN.tar.gz -C /usr/share/nginx/html/

4.修改nginx配置文件vim /etc/nginx/nginx.conf

 

5.修改php配置文件vim /etc/php-fpm.d/www.conf

 

6.修改wordpress网站目录所有者和所属组为nginx

 

chown -R nginx. /usr/share/nginx/html/wordpress/

7.创建wordpress数据库并授权

 

8.另一个服务器同样操作部署wordpress

9.配置proxy

yum nginx -y

vim /etc/nginx/nginx.conf

 

10.启动所有服务(nginx、php-fpm、mysql)

访问代理服务器IP:192.168.227.15

 

11.让后端nginx服务器任意挂掉一台

pkill nignx,再次访问代理服务器ip不受影响

  

访问不受影响

原文地址:https://www.cnblogs.com/l-gang/p/12182697.html