前端服务器:192.168.26.210

后端服务器:192.168.26.212,192.168.26.218

nginx和Apache安装略,可以直接YUM安装。

#nginx.conf配置文件

nginx反向代理及负载设置详解(服务器维护时间设置)

# The default server

#

upstream idc.jerry.com { 

      server 192.168.26.212:80; 

      server 192.168.26.218:80; 

}

server {

    listen       80 default_server;

    server_name  idc.jerry.com;

    #charset koi8-r;

    #access_log  logs/host.access.log  main;

    # Load configuration files for the default server block.

    include /etc/nginx/default.d/*.conf;

    location / {

        root   /usr/share/nginx/html;

        index  index.html index.htm;

        proxy_pass http://idc.jerry.com;

    }

    error_page  404              /404.html;

    location = /404.html {

        root   /usr/share/nginx/html;   

    }

    # redirect server error pages to the static page /50x.html

    #

    error_page   500 502 503 504  /50x.html;   

    location = /50x.html {

        root   /usr/share/nginx/html;             #设置成维护页面          

    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80

    #

    #location ~ \.php$ {

    #    proxy_pass   http://127.0.0.1;

    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

    #

    #location ~ \.php$ {

    #    root           html;

    #    fastcgi_pass   127.0.0.1:9000;

    #    fastcgi_index  index.php;

    #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;

    #    include        fastcgi_params;

    #}

    # deny access to .htaccess files, if Apache's document root

    # concurs with nginx's one

    #

    #location ~ /\.ht {

    #    deny  all;

    #}

}


nginx反向代理及负载设置详解(服务器维护时间设置)

nginx反向代理及负载设置详解(服务器维护时间设置)

刷新访问前端IP:192.168.26.210

nginx反向代理及负载设置详解(服务器维护时间设置)

nginx反向代理及负载设置详解(服务器维护时间设置)

nginx反向代理及负载设置详解(服务器维护时间设置)


后端服务器都挂掉时:返回服务器维护时间。

nginx反向代理及负载设置详解(服务器维护时间设置)


转载于:https://blog.51cto.com/jdonghong/1887598

相关文章:

  • 2021-12-21
  • 2022-02-05
  • 2021-12-10
  • 2021-12-10
  • 2021-08-10
  • 2021-06-03
猜你喜欢
  • 2022-01-11
  • 2021-06-14
  • 2021-12-22
  • 2021-10-19
  • 2021-12-17
  • 2022-12-23
  • 2022-02-19
相关资源
相似解决方案