2016-12-14 3 views
0

4つのTomcatアプリケーションの負荷を分散するようにngnixを設定しました。私は私のサーバー構成セクションのリライト/リダイレクトルールに関する質問があります。nginixサーバーの書き換え設定

?どのように私は私がこれを正しく理解していなかったが、リダイレクトURLあなたのようだ場合、私は謝罪http://zavlb.rand.int.co1に対する要求がhttp://zavlb.rand.int.co1/zi/za/fpages/aaa/FPAGE_AAA_00_00.xhtml

upstream zavlb { 
     ip_hash; 
    # server applnx1.za.rand.int.co1:8080 weight=2; 
     server applnx01.za.rand.int.co1:8080 weight=2; 
     server applnx02.za.rand.int.co1:8080 weight=2; 
     server applnx03.za.rand.int.co1:8080 weight=2; 
     server applnx04.za.rand.int.co1:8080 weight=2; 
    } 


    server { 
     listen  80; 
     server_name zavlb.rand.int.co1; 
     client_max_body_size 5m; 

     location/{ 
      proxy_pass http://zavlb; 
      proxy_set_header Host $host; 
     } 

     # redirect server error pages to the static page 404/index.html 
     # 
     error_page 404 500 502 503 504 404/index.html; 
     location = 404/index.html { 
      root /home/za/www; 

     access_log /var/log/nginx/access.log combined; 
     } 
    } 

答えて

0

に行かせるのですか?その場合、ここで説明するようにnginx書き換えモジュールを使用することができます:http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite。例:あなたが要求はあなたのルートをヒットしているとき、バックエンドサーバ(プロキシ)から、そのファイルを提供したい場合は

rewrite/http://zavlb.rand.int.co1/zi/za/fpages/aaa/FPAGE_AAA_00_00.xhtml last; 

しかし、あなたはnginx try_filesを使用することができ、同様:

location/{ 
    try_files $uri $uri/ /index.xhtml /zi/za/fpages/aaa/FPAGE_AAA_00_00.xhtml =404; 
} 

は、この情報がお役に立てば幸いです。

関連する問題