- 追加された行はこの色です。
- 削除された行はこの色です。
*Pound [#a9fc48f7]
RIGHT:更新日&lastmod();
**Make エラー [#ke748236]
Pound-2.5.tgzではMakeでエラーするので、Pound-2.6f.tgzをGetしたら問題なかった
pound.h:340: error: expected specifier-qualifier-list before ‘LHASH’
make: *** [pound.o] エラー 1
$ wget http://www.apsis.ch/pound/Pound-2.6f.tgz
----------
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 <---PoundのIPアドレス
Port 80 <---Poundの受信ポート
xHTTP 2 <---WebDAVを通過させるため(WindowsのWebDAVで確認した)
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
# openssl rsa -in server-key.pem -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
# 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
**アクセスポートにより振り分け [#x61e0a0b]
アクセスするポートによりサーバとポートを指定する~
192.yyy.yyy.yyy:8088にアクセスすると192.xxx.xxx.xxx:80にフォワード~
ポート8089アクセスすると10.zzz.zzz.zzzz:8080にフォワード~
これで一つのマシンがグローバルでアクセスできたらポート指定で
内部サーバにもアクセス可能。
pound.cfg
User "nobody"
Group "nobody"
# 8088ポートの転送先アドレスポート指定
ListenHTTP
Address 192.yyy.yyy.yyy
Port 8088
Service
BackEnd
Address 192.xxx.xxx.xxx
Port 80
Priority 9
End
End
End
# 8089ポートの転送先アドレスポート指定
ListenHTTP
Address 192.yyy.yyy.yyy
Port 8089
Service
BackEnd
Address 10.zzz.zzz.zzz
Port 8080
Priority 9
End
End
End
**Logの指定 [#rc378890]
デフォルトではlogは/var/log/messagesに入る。これを/var/log/pound.logに入れるには
syslogを使用して、pound.cfgと/etc/syslog.confに追加する
''pound.cfg''
User "nobody"
Group "nobody"
LogFacility local5 <--追加(あいているlocal0〜7のあいているところ)
LogLevel 3 <--追加(0〜4が指定できる [emerg〜warning])
''/etc/syslog.conf''
# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!
*.info;mail.none;authpriv.none;cron.none;local5.none /var/log/messages
^^^^^^^^^^^追加:これがないと/var/log/messagesにも記入される
(略)
# Save pound messages to pound.log
local5.* /var/log/pound.log <--追加(local5はpound.cfgに合わせる)
syslogdとpoundを再起動
**WebDAVへのSSL通信 (2015年8月設定)[#t894ea83]
poundまでSSL通信を行い、バックのWindowsサーバ上のWebDAVのはhttp通信を行う
ユーザ認証はWebDAVで行う
''この設定でエクスプローラからも動作した。''
------------------- ------------
|Pound | http |WebDAV |
http /https| |192.168.10.78 | http |
=============| Comon Name |=======================| |
192.168.55.1 | pound.ism21.net| 192.168.10.60 | |
| | | |
------------------- ------------
''pound.cfg''
User "nobody"
Group "nobody"
ListenHTTP
Address 192.168.55.1
Port 80
# Cert "/usr/local/etc/pound.pem"
xHTTP 2
Service
BackEnd
Address 192.168.10.60
Port 80
Priority 9
End
End
End
ListenHTTPS
Address 192.168.55.1
Port 443
Cert "/usr/local/etc/pound.pem"
xHTTP 2
Service
BackEnd
Address 192.168.10.60
Port 80
Priority 9
End
End
End