首页 > 系统 > Linux >

Linux下安装Lnmp环境之Nginx 负载均衡配置

2017-02-17

Linux下安装Lnmp环境之Nginx 负载均衡配置。

Linux下安装Lnmp环境之Nginx 负载均衡配置。

1、准备

项目

mkdir /usr/www/www.local.com.8091/
echo 8091 > /usr/www/www.local.com.8091/index.php

mkdir /usr/www/www.local.com.8092/
echo 8092 > /usr/www/www.local.com.8092/index.php

mkdir /usr/www/www.local.com.8093/
echo 8093 > /usr/www/www.local.com.8093/index.php

配置文件
Linux下安装Lnmp环境之Nginx Vhosts配置

vim /usr/local/nginx/conf/vhosts/www.local.com.8091.conf
vim /usr/local/nginx/conf/vhosts/www.local.com.8092.conf
vim /usr/local/nginx/conf/vhosts/www.local.com.8093.conf

2、负载均衡配置

vim /usr/local/src/nginx/conf/vhosts/www.local.com.conf

upstream ser_name{
    server 192.168.43.132:8091 weight=5;
    server 192.168.43.132:8092 weight=1;
    server 192.168.43.132:8093 weight=1;
}
server {
    listen       80;
    server_name  www.local.com;
    location / {
        proxy_pass http://ser_name;
        proxy_redirect default;
    }
}
相关文章
最新文章
热点推荐