windows下tomcat7+nginx1.8負載平衡

來源:互聯網
上載者:User

標籤:server   ase   修改   clear   dex   均衡   lis   伺服器   span   

1、Server Load Balancer是一種常用的跨多個應用程式執行個體 技術最佳化資源使用率,最大化輸送量, 減少延遲,並確保容錯配置。

2、使用nginx作為非常有效HTTP負載平衡器 將流量分發給幾個應用程式伺服器和改善 效能、延展性和可靠性nginx的web應用程式。

工具/原料 
  • tomcat7 :http://pan.baidu.com/s/1pJxlzF9
  • nginx1.8 :http://pan.baidu.com/s/1nts5TTB
  • 測試專案nginx :http://pan.baidu.com/s/1hq6niz6
方法/步驟 
  1. 1

    將tomcat複製成兩份,如

  2. 2

    修改兩個tomcat的連接埠,找到路徑“conf\”的server.xml,

    修改後情況分別如下:

     

  3. 3

    1、下載“測試專案nginx",解壓後如;

    2、分別在兩個tomcat的“conf\Catalina\localhost“(沒有此目錄則建立),建立nginx.xml,內容分別為:

    <!-- tomcat7_9001配置 -->

    <Context docBase="D:\project\nginx9001" reloadable="false"> 

    </Context>

    <!-- tomcat7_9002配置 -->

    <Context docBase="D:\project\nginx9002" reloadable="false"> 

    </Context>

  4. 4

    配置nginx,找到路徑”nginx-1.8.0\conf“的 nginx.conf 檔案,修改情況如:

    upstream tomcat_nginx{

       server 127.0.0.1:9001;

       server 127.0.0.1:9002;

    }

    proxy_pass http://tomcat_nginx;

  5. 5

    1、啟動tomcat7_9001與tomcat7_9002

    2、啟動nginx

    3、訪問:http://127.0.0.1:9500/nginx/,負載平衡部署成功如:

    END
注意事項 
  • tomcat與nginx均為官方純淨應用
  • 無法啟動時,有可能連接埠被佔用,請修改連接埠

windows下tomcat7+nginx1.8負載平衡

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.