zoukankan      html  css  js  c++  java
  • 负载均衡简单配置

    首先,准备好配置环境:最少开三台服务器,并下编译好nginx命令,做好映射。

    先在主配置服务器配置文件:

    vim /usr/local/nginx/conf/nginx.conf

      worker_processes 1;

      events {

        worker_connections  1024;

      }

    http {

      include  mime,types;

      default_type  application/octet-stream;

      sendfile  on;

      keepalive_timeout  65;

      upstream dafault_server {

        server 192.168.126.145:80 weight;

      }

      upstream static_server {

        server 192.168.126.147:8 weight;

      }

      server {

        listen  80;

        server_name www.yunjisuan.com;

        location / {

          proxy_pass http://default_server;

        }

        location /static/ {

          proxy_pass http://static_server;

        }

      }

    }

    将静态图片放入静态服务器中:

    配置动态服务器:

    vim /usr/local/nginx/html/www/index.html

      <title>welcome to beijing</title>

      <hl>zuida</hl>

      <h4>zuixiao</h4>

      <img src="C:UsersAdministratorDesktop(图片存储路径)">

  • 相关阅读:
    git clone失败
    矩阵相乘
    pandas中关于DataFrame 去除省略号
    Linux系统清除缓存
    Git 远程仓库 更新url
    看不到git远程分支
    c++
    undefined reference to symbol' pthread_create@@GLIBC_2.2.5'
    ssh 与远程机器保持心跳(linux)
    python 读取文件第一列 空格隔开的数据
  • 原文地址:https://www.cnblogs.com/mashuang/p/10065621.html
Copyright © 2011-2022 走看看