AWSにリバースプロキシーを構築

「AWSにプロキシを構築」の続き

・セキュリティの設定
 AWSのセキュリティグループ
  インバウンドにルールを追加する
   TCP、80、0.0.0.0/0
 Windowsファイアウォールにてsquis.exeの入力規則にTCPプロトコルの80ポートを追加する

・squidの設定
 squid_reverse.confの作成(抜粋)

#Privarte IPの80番ポートで待ち受ける
#accelモード(リバプロ)で稼働するaccelモード(リバプロ)で稼働する
#ブラウザのキャッシュコントロールを無効にする
http_port 80 accel defaultsite=xxx.xxx.xxx.xxx ignore-cc

visible_hostname www.chombo.work

pid_filename /var/run/${service_name}.pid

cache_peer domain.org parent 80 0 no-query originserver

max_filedescriptors 3200

#エラー画面の設定
#/usr/share/squid/createdErrPage内に独自のエラーページ作成
#Squidを隠蔽するため、全エラーを404で返す
#デフォルトだとアクセス制御で拒否されたらSquidは403を返す
#404.htmlは適当に作成し、error_directory内に格納する
error_directory /usr/share/squid/createdErrPage
deny_info 404:404.html dmz
deny_info 404:404.html all
#クライアントのIPアドレスをそのままWebサーバへ渡す
forwarded_for on

#Squidを使用していることを隠蔽するため各種htmlヘッダを削除
#Webサーバが返すServerヘッダも削除される
reply_header_access X-Squid-Error deny all
reply_header_access X-Cache deny all
reply_header_access Via deny all
reply_header_access Server deny all

#コンテンツキャッシュを行わない設定
acl nocache src all
cache deny nocache
cache_store_log none

#エラーページをキャッシュしない(保有時間を0秒に)
negative_ttl 0 seconds

#Only allow cachemgr access from localhost
http_access allow all

#Deny requests to certain unsafe ports
http_access deny !Safe_ports

#Deny CONNECT to other than secure SSL ports
http_access deny CONNECT !SSL_ports

#And finally deny all other access to this proxy
http_access deny all

logformat squidReverse %tl %6tr %>a %Ss/%03>Hs %

#ログファイル名を指定
access_log stdio:/var/log/squid/accessReverse.log squidReverse

#Squidに関するエラー・デバックログを記録するファイル名を指定
cache_log /var/log/squid/cacheReverse.log

#ログを13世代保有する
logfile_rotate 13

・squidの起動

squid -f /etc/squid/squid_reverse.conf -n squidReverse -N

をタスクマネージャに登録
 Diladele.Squid.Tray.exeのStop Squid Serviceでプロキシーを止めた場合、同時にリバースプロキシ―も止まるので注意

・DMSの登録
 Elastic IPをMyDNSに固定アドレスとして登録
  IPアドレスの通知は定期的に行う必要がある。通知するIPアドレスは無視される模様

・クライアントのIPアドレスが変わった場合
 セキュリティグループのインバウンドを変更(8080,3389)
 squid.conf,squid_reverse.confを変更
 MyDNS.comにAWSからログイン

・EC2のPrivate IPが変わった場合
 セキュリティグループのインバウンドを変更
 squid.conf,squid_reverse.confを変更

・ディスククリーンアップを追加
 PowerShellでAdd-WindowsFeature Desktop-Experience