●squid.confを編集する

 次にsquid.confの編集を行う。locateコマンドなどでsquid.confのありかを捜しておこう。RPMでインストールされているなら,

# cd /etc/squid
# vi squid.conf

のようにすればよい。squid.confを開いたら,vi上で「/redirect_program」と入力して検索し,「redirect_program」以下を下記のように変更し,保存してSquidの再起動を行う。

# TAG: redirect_program
# Specify the location of the executable for the URL redirector.
# Since they can perform almost any function there isn't one included.
# See the Release-Notes for information on how to write one.
# By default, a redirector is not used.
#
#Default:
# none

redirect_program /usr/local/squirm/bin/squirm
redirect_children 10
(↑この部分を追加)

# TAG: redirect_children
# The number of redirector processes to spawn. If you start
# too few Squid will have to wait for them to process a backlog of
# URLs, slowing it down. If you start too many they will use RAM
# and other system resources.

-
※redirect_program リダイレクタプログラムへのパス指定
 redirect_children リダイレクタプログラムを立ち上げる数。ここでは10に指定している

・Squidの再起動

 squid.confの編集が終わったら,

# /etc/rc.d/init.d/squid restart

のように入力して,Squidを再起動させよう。

・グループviralator,ユーザーviralatorの追加

 最後にグループ「viralator」と,それに属するユーザー「viralator」を追加する。

# groupadd viralator
# useradd -g viralator -s /bin/false viralator


●Apacheの設定

 httpd.confに下記のように加えて保存し,Apacheの再起動を行う。VirtualHostの設定を行うのが目的だ。

 RPMパッケージでインストールしたApacheならば,

# vi /etc/httpd/conf/httpd.conf

として,httpd.confを編集しよう。先ほどのように,vi上で「/VirtualHost」として項目を検索して,VirtualHostにリスト3のようなパラメータを追加する。なお,環境に応じてIPアドレスやディレクトリは変更してほしい。

リスト3■httpd.confでの変更箇所
-
<VirtualHost 192.168.1.10>
ServerAdmin webmaster@example.com
DocumentRoot /var/www/viralator
ServerName proxy.example.com
ErrorLog /var/logs/error_log
TransferLog /var/logs/access_log
ScriptAlias /viralator/ /var/www/viralator/
User viralator
Group viralator
</VirtualHost>
-
※設定するマシンのアドレスが192.168.1.10の場合

変更が終わったら,

# /etc/rc.d/init.d/httpd restart

として,apacheを再起動しよう。

PREV 4/5 NEXT