nginx反向代理配置

来源:互联网 发布:甲骨文软件 薪资 编辑:程序博客网 时间:2024/06/05 16:13
#vim nginx.conf

这里写图片描述

添加上图中红框中两处即可,其他可以默认


upstream march.com {    server 192.168.0.12:35677;    server 192.168.0.13:35677;    }
location / {            root   html;            index  index.html index.htm;            proxy_pass http://march.com;        }

192.168.0.12:35677、192.168.0.13:35677为后端服务的地址(例如tomcat服务)
红框1中的march.com保持与红框2中的http://march.com对应

启动后即可通过访问nginx机器的36578端口来使用后端两个web服务,达到反向代理和负载均衡。

原创粉丝点击