.. index:: squid_3.4.6 squid 3.4.6 ============= .. contents:: Contents =========== 実行環境 =========== | :ref:`sl_6.4` | :ref:`ubuntsu_server_12.04` =========== 最終検証日 =========== 2014/07/29 =========== 依存関係 =========== * :doc:`../../language/perl/index` * :doc:`../../library/openssl/index` =========== コンパイル =========== .. note:: 基本的には管理者ユーザ(rootなど)で実施していることを前提としています .. code-block:: bash #------------------------------------------------------------ # squid 3.4.6 #------------------------------------------------------------ BASE=/opt/brew export LD_RUN_PATH=${BASE}/lib # ソースダウンロード先 comp_dir=/usr/local/src # パッケージ名 pack_name=squid # バージョン version=-3.4.6 # ソースのファイル形式 ext=.tar.bz2 # 解凍コマンド tar_cmd="tar jxf" # インストール先ディレクトリ ins_dir=/opt/${pack_name}/${version##-} # ダウンロード元パッケージ dl_uri="http://www.squid-cache.org/Versions/v3/3.4/squid-3.4.6.tar.bz2" # コンパイル時の並列数 proc_num=`cat /proc/cpuinfo | grep processor | wc -l` cd ${comp_dir} rm -rf ${pack_name}${version} test -f ${pack_name}${version}${ext} \ || wget ${dl_uri} -O ${pack_name}${version}${ext} ${tar_cmd} ${pack_name}${version}${ext} cd ${pack_name}${version} ./configure \ --prefix=${ins_dir} \ --enable-icap-client \ --enable-ssl \ --with-openssl=${BASE} \ && nice -n 15 make -j${proc_num}\ && make install chmod -R 777 ${ins_dir}/var/logs ================ Pathの設定 ================ .. code-block:: bash for type in $(ls -1 ${ins_dir}) do for src in $(find ${ins_dir}/${type} -xtype f) do parent=`dirname ${src#*/${type}/}` mkdir -p /opt/brew/$type/$parent echo "ln -fs ${src} ${BASE}/${type}/${parent}/${filename}" ln -fs ${src} ${BASE}/${type}/${parent}/${filename} done done grep -q ${BASE}/bin ~/.bashrc \ || echo "export PATH=${BASE}/bin:${BASE}/sbin:"'${PATH}' >> ~/.bashrc \ ; source ~/.bashrc ======================== 主なconfigureオプション ======================== ``--prefix=[DIR]`` インストール先ディレクトリの指定 =============== 設定ファイル =============== 設定ファイルの場所 --------------------- .. code-block:: bash # ファイルの格納場所がわからない場合、下記コマンドを実行します # -f オプションの説明のところに記載があります squid --help 最低限の設定 --------------- プロキシ丸出しもさみしいので下記は最低限設定します。 .. code-block:: bash # diff -u squid.conf.default squid.conf --- squid.conf.default 2014-07-29 20:13:11.413998642 +0900 +++ squid.conf 2014-07-29 22:43:23.577986093 +0900 @@ -24,6 +24,16 @@ acl Safe_ports port 777 # multiling http acl CONNECT method CONNECT +# キャッシュしない +cache deny all + +# # アクセスを許可するサイト +# acl whitelist_regex url_regex "/path/to/whitelist_regex" +# http_access allow whitelist_regex +# # アクセスを拒否するサイト +# acl blacklist_regex url_regex "/path/to/blacklist_regex" +# http_access deny blacklist_regex + # # Recommended minimum Access Permission configuration: # @@ -71,3 +81,9 @@ refresh_pattern ^gopher: 1440 0% 1440 refresh_pattern -i (/cgi-bin/|\?) 0 0% 0 refresh_pattern . 0 20% 4320 + +# プロキシであることの隠ぺい +visible_hostname unkown +request_header_access X-FORWARDED-FOR deny all +request_header_access Via deny all +request_header_access Cache-Control deny all ============== 構文チェック ============== .. code-block:: bash squid -k parse ====== 起動 ====== .. code-block:: bash # 通常起動 squid # 非デーモン起動 squid -N ====== 停止 ====== .. code-block:: bash squid -k shutdown ===================== ログローテーション ===================== .. code-block:: bash squid -k rotate