Nginx最简单负载均衡配置【双Tomcat】负载

本文讲解最简单的Nginx配置方法,双Tomcat负载,

Nginx配置文件内容  nginx\conf\nginx.conf 

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;

    server {
        listen       80;
        server_name  tomcat1;

        location / {
			proxy_pass   http://192.168.1.1;
        }
	}

    server {
        listen       80;
        server_name  tomcat2;

        location / {
			proxy_pass   http://192.168.1.2;
        }

    }
}
发布了46 篇原创文章 · 获赞 8 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/qq_38056435/article/details/101763780