您的位置:首页 > 运维架构 > Nginx

nginx方向代理2

2016-09-01 00:04 162 查看
进入/usr/local/nginx/conf/目录,编写nginx.conf

原文:server {

       listen       80;

       server_name  test3.taotao.com;

 

       #charset koi8-r;

 

       #access_log logs/host.access.log  main;

 

       location / {

           root   html-test3;

           index  index.html index.htm;

       }

   }
使用代理后:

 upstream tomcats{

       server 192.168.25.148:8080 weight=2;

       server 192.168.25.148:8081;

   }

 

  server {

       listen       80;

       server_name  tomcat.taotao.com;

 

       #charset koi8-r;

 

       #access_log logs/host.access.log  main;

 

       location / {

           proxy_pass   http://tomcats;
           index  index.html index.htm;

       }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: