プロキシサーバ(squid) 構築

2021-06-18

squidのインストール

(1)yum でインストールする

yum -y install squid

Squid設定ファイル編集

(2)設定ファイルをバックアップ

cp -p /etc/squid/squid.conf /etc/squid/squid.conf.org

(3)設定ファイルを編集

# vi /etc/squid/squid.conf

acl CONNECT method CONNECT
# 追加(192.168.24.0/255.255.255.0からのプロキシサーバーへのアクセスを許可(1/2))
acl local-network src 192.168.24.0/255.255.255.0

http_access allow localhost
# 追加(192.168.1.0/255.255.255.0からのプロキシサーバーへのアクセスを許可(2/2))
http_access allow local-network
http_access deny all

# forwarded_for on
# 追加(プロキシサーバーを使用している端末のローカルIPアドレスを隠蔽化)
forwarded_for off

# TAG: visible_hostname
# If you want to present a special hostname in error messages, etc,
# then define this. Otherwise, the return value of gethostname()
# will be used. If you have multiple caches in a cluster and
# get errors about IP-forwarding you must set them to have individual
# names with this setting.
#
#Default:
# none

# ホスト名を記述
visible_hostname www.example1.jp

# ポート番号を記述
http_port 3128

Squid起動

(1)Squidの起動

# /etc/rc.d/init.d/squid start
init_cache_dir /var/spool/squid... squid を起動中: . [ OK ]

(2)自動起動を設定

# chkconfig squid on

スポンサーリンク

0
0

LinuxLinux,squid

Posted by admin