*Pound [#a9fc48f7]

RIGHT:更新日&lastmod();  

Webサーバのロードバランサ(バックProxyとしても)として利用できる。

[[ここ:http://www.apsis.ch/pound/]]からDownlaodしてくる。

**構成図 [#jef79c3c]

 ---------------                ----------------
 |             |                |              |
 | Pound       |                | Web          |
 | 10.3.1.50   |================| 10.3.1.51    |
 |             |        |       |              |
 |             |        |       |              |
 ---------------        |       ----------------
                        |                       
                        |       ----------------
                        |       |              |
                        |       | Web          |
                        ========| 10.3.1.52    |
                                |              |
                                ----------------


**インストール [#edb2fd70]

 $ tar zxvf Pound-2.1.6.tgz
 $ cd Pound-2.1.6
 $ ./configure --with-ssl=/usr (--with-ssl=ssl_dir OpenSSL home directory)
 (openssl-develも必要)
 $ make
 $ su
 # make install

**設定 [#x906b2cb]

pound-1xと-2xではpound.cfgの書式が異なる。今回は-2xで試してみる。

/usr/local/etc/pound.cfgを編集(作成)

***単純なリバースプロキシの設定(2台のマシンにプライオリティの差をつける) [#o63253a7]

 User        "nobody"  <--起動ユーザの指定
 Group       "nobody"  <--起動グループの指定
 ListenHTTP
   Address 10.3.1.50
   Port    80
 
   Service
     BackEnd
       Address 10.3.1.51
       Port 80
       Priority 9    <---デフォルトは1 1-9で指定で9がプライオリティが高い
     End
 
     BackEnd
       Address 10.3.1.52
       Port 80
       Priority 1
     End
   End
 End


**設定ファイルの確認 [#fe942fea]

 # /usr/local/sbin/pound -cv
 Config file /usr/local/etc/pound.cfg is OK

**起動 [#oe6d0411]

 #/usr/local/sbin/pound

 # ps ax
 
 15268 ?        S      0:00 /usr/local/sbin/pound
 15269 ?        S      0:00 /usr/local/sbin/pound
 15270 ?        S      0:00 /usr/local/sbin/pound
 15271 ?        S      0:00 /usr/local/sbin/pound
 15272 ?        S      0:00 /usr/local/sbin/pound

/var/log/messagesにlogが出るので起動失敗では確認する


**HTTPS [#m77c490a]

poundでSSL接続させるためにサーバキー、公開キーを作成する。Vineの場合すでにApacheで利用されているのでそれを利用する。

***サーバキー(秘密キー) [#y469ab7a]

 # cp /etc/httpd/conf/ssl.key/server.key server-key.pem

***公開キー(証明書) [#z25761b0]

 # cp /etc/httpd/conf/ssl.crt/server.crt  pound.pem

二つのキーをマージしてpoundでは利用するのでマージする。

 # cat server-key.pem >> pound.pem

**自分でサーバキー(秘密キー)、公開キー(証明書)を作成するとき [#x94d59ea]

***サーバキー(秘密キー) [#ve50484c]

 # openssl genrsa -des3 -out server-key.pem 1024
 Generating RSA private key, 1024 bit long modulus
 .........++++++
 .......++++++
 e is 65537 (0x10001)
 Enter pass phrase for server-key.pem:*****
 Verifying - Enter pass phrase for server-key.pem:*****

***サーバキーのパスワードを聞かれることをなくす [#r7aac94e]

 # openssl rsa -in server-key.pem -days 365 -out server-key.pem
 Enter pass phrase for server-key.pem:*****
 writing RSA key

***公開キー(証明書) [#p8c98ec8]

 # openssl req -new -key server-key.pem -x509 -days 365 -out pound.pem
 You are about to be asked to enter information that will be incorporated
 into your certificate request.
 What you are about to enter is what is called a Distinguished Name or a DN.
 There are quite a few fields but you can leave some blank
 For some fields there will be a default value,
 If you enter '.', the field will be left blank.
 -----
 Country Name (2 letter code) [AU]:JP
 State or Province Name (full name) [Some-State]:Mie Pref
 Locality Name (eg, city) []:Matsusaka
 Organization Name (eg, company) [Internet Widgits Pty Ltd]:MCU
 Organizational Unit Name (eg, section) []:
 Common Name (eg, YOUR name) []:localhost
 Email Address []:student@localhost


二つのキーをマージしてpoundでは利用するのでマージする。

 # cat server-key.pem >> pound.pem

***設定 [#raf34a47]

以下の内容をpound.cfgに追加すると10.3.1.50にssl接続しに来たら10.3.1.51の
ポート80に投げる。

 ListenHTTPS
     Address 10.3.1.50
       Port    443
       Cert    "/usr/local/etc/pound.pem"
       Service
           BackEnd
               Address 10.3.1.51
               Port    80
           End
       End
 End

*** &aname(reservation){設定(指定ディレクトリを指定ホストに転送)}; [#bfffe561]
http://10.3.1.50/51/はhttp://10.3.1.51/51/をアクセスし、http://10.3.1.50/52/はhttp://10.3.1.52/52/をアクセスする。

以下の内容を「単純なリバースプロキシの設定」の前に追加する。 &color(red){Servceはパターンに合ったものから処理し、先に記入されたものが優先される};


  Service
    URL "/51/.*"
    BackEnd
      Address 10.3.1.51
      Port 80
      Priority 1
    End
  End
 
  Service
    URL "/52/.*"
    BackEnd
      Address 10.3.1.52
      Port 80
      Priority 1
    End
  End

**アクセスURLにより異なるマシンへの振り分け [#y146fad3]

アクセスURLを変えてアクセスすると異なるマシンへのアクセスを実現する方法が不明
出来きるのか?

PoundはPound.cfgに記載順に実行されるので、先に[[指定ディレクトリ>#reservation]]に転送する方法で記載し、その後デフォルトの転送さきとして以下の指定をする。

 (指定ディレクトリの内容)
 
   Service
    Redirect "http://10.3.1.50:8080"
  End

トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS