「さくらのVPS」httpのproxyを作る

前に書いたような気がするけど、akamaiサーバーへのアクセスが遅いので、さくらのサーバーをproxyでかませてみると改善するかもしれないと、proxyサーバーを動かしてみる。

squid*1をインストールして、ポート番号を変えて、ダイジェスト認証を掛ける。目的からしてhttpのみ対応。

設定は下記。

--- squid.conf.default  2010-03-31 16:46:03.000000000 +0900
+++ squid.conf  2011-10-27 22:54:18.000000000 +0900
@@ -141,6 +141,7 @@
 #      Then, set this line to something like
 #
 #      auth_param digest program /usr/libexec/digest_auth_pw /usr/etc/digpass
+auth_param digest program /usr/lib64/squid/digest_pw_auth /etc/squid/passwd
 #
 #      "children" numberofchildren
 #      The number of authenticator processes to spawn. If you start too few
@@ -566,7 +567,7 @@
 #Examples:
 #acl macaddress arp 09:00:2b:23:45:67
 #acl myexample dst_as 1241
-#acl password proxy_auth REQUIRED
+acl password proxy_auth REQUIRED
 #acl fileupload req_mime_type -i ^multipart/form-data$
 #acl javascript rep_mime_type -i ^application/x-javascript$
 #
@@ -634,6 +635,7 @@

 # And finally deny all other access to this proxy
 http_access allow localhost
+http_access allow password
 http_access deny all

 #  TAG: http_access2
@@ -918,7 +920,7 @@
 #      visible on the internal address.
 #
 # Squid normally listens to port 3128
-http_port 3128
+http_port ナイショ

 #  TAG: https_port
 #      Usage:  [ip:]port cert=certificate.pem [key=key.pem] [options...]
@@ -4276,6 +4278,7 @@
 #
 #Default:
 # forwarded_for on
+forwarded_for off

 #  TAG: cachemgr_passwd
 #      Specify passwords for cachemgr operations.

/etc/squid/passwd には、ユーザ名:パスワード の形で平文で書けば良いみたい。

*1:Version 2.6.STABLE21