ナビゲーション
FrontPage
FreeBSD
Linux
Citrix XenServer
VMware ESXi
Unixコマンド
MySQL
PostgreSQL
Windows
CMS/CRM
クラウド
用語
PHPスクリプト
Bashシェルスクリプト
Rubyスクリプト
開発日記
検索
ツールボックス
新しいページの作成
バックアップの表示
外部のリンク元
最近更新したページ
全ページ
ヘルプ
凍結
アップロード
ページ名の変更
最新の40件
2016-08-17
Linux/NagiosQL
Linux/CentOSチューニング
2016-02-23
Linux/ソフトウェアRAID復旧手順
2016-02-18
FreeBSD/DHCP
FreeBSD/squid
2016-02-15
Unixコマンド/file
2016-02-05
FreeBSD/DynaBook
FreeBSD/Linux compatibility
2016-01-21
PHPスクリプト/PEAR DBインストールできない
PHPスクリプト/PEAR DB
2016-01-20
PHP/フレームワーク/Zend Framework
PHP/フレームワーク
FreeBSD/Postfix+amavisd+clamav
2016-01-15
FreeBSD/sl
2015-12-04
Unixコマンド/dig
Unixコマンド/nslookup
Unixコマンド/traceroute
Linux/rsync
FreeBSD/rsync
Unixコマンド/vipw
2015-11-25
Linux/Postfix+MySQL+Postfix AdminによるバーチャルSMTPサーバの構築
Linux/Postfix + postgrey
2015-11-24
Linux/Postfix + amavisd + clamav
2015-05-25
Unixコマンド/ifconfig
2015-05-23
Unixコマンド/netstat
Unixコマンド/route
Unixコマンド/lsof
Unixコマンド/disown
Unixコマンド/time
Unixコマンド/crontab
2015-05-22
Unixコマンド/nohup
Unixコマンド/fgとbg
Unixコマンド/nice
Unixコマンド/kill
Unixコマンド/jobs
Unixコマンド/restor
Unixコマンド/dump
Unixコマンド/uncompress
Unixコマンド/compress
Unixコマンド/zcat
total:
7720
today:
1
yesterday:
0
now:
2
本文
ノート
?
編集
差分
一覧
FreeBSD/squid の編集
*&SIZE(15){''squid【スクイッド】''}; [#sc1102c5] [[dokuwiki.fl8.jp掲載済>http://dokuwiki.fl8.jp/02_freebsd/01_net/06_squid]] スクイッドと読むらしいですね。日本語訳するとヤリイカの事だそうです。~ squidでプロキシキャッシュサーバを作成してみたいと思います。~ #contents **''環境''&aname(A); [#re0c4012] FreeBSD 6.0~ squid 2.5~ ~ **''インストール''&aname(B); [#ba9decf1] # cd /usr/ports/www/squid # make install clean ;rehash ~ **''/usr/local/etc/squid/squid.confを設定''&aname(C); [#m91013cd] ログディレクトリとキャッシュディレクトリを変更しました。 no_cache deny QUERY cache_dir ufs /work/squid 100 16 256 ↑cacheフォルダの場所指定/キャッシュ容量/サブフォルダ数/更にサブフォルダ数 cache_log /var/squid/cache.log cache_store_log /var/squid/store.log pid_filename /var/run/squid/squid.pid auth_param basic children 5 auth_param basic realm Squid proxy-caching web server auth_param basic credentialsttl 2 hours auth_param basic casesensitive off refresh_pattern ^ftp: 1440 20% 10080 refresh_pattern ^gopher: 1440 0% 1440 refresh_pattern . 0 20% 4320 acl all src 0.0.0.0/0.0.0.0 acl manager proto cache_object acl localhost src 127.0.0.1/255.255.255.255 acl to_localhost dst 127.0.0.0/8 acl SSL_ports port 443 563 acl Safe_ports port 80 # http acl Safe_ports port 21 # ftp acl Safe_ports port 443 563 # https, snews acl Safe_ports port 70 # gopher acl Safe_ports port 210 # wais acl Safe_ports port 1025-65535 # unregistered ports acl Safe_ports port 280 # http-mgmt acl Safe_ports port 488 # gss-http acl Safe_ports port 591 # filemaker acl Safe_ports port 777 # multiling http acl CONNECT method CONNECT acl private src 192.168.1.0/255.255.255.0 http_access allow manager localhost http_access allow private http_access deny manager http_access deny !Safe_ports http_access deny CONNECT !SSL_ports http_access deny all http_reply_access allow all icp_access allow all header_access Cache-Control deny all header_access Via deny all header_access X-Forwarded-For deny all header_access Server deny all header_access User-Agent deny all header_access Accept allow all header_replace User-Agent Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0) coredump_dir /var/log/squid **runディレクトリとlogディレクトリ作成 [#r9e5a070] # mkdir /var/run/squid # chmod squid:wheel /var/run/squid # mkdir /var/log/squid # chmod squid:wheel /var/log/squid **''起動''&aname(D); [#reb2a08b] ■squid.conf修正後、下記のコマンドでキャッシュディレクトリを作成する。 # squid -z ■起動シェルにて起動。 # /usr/local/etc/rc.d/squid start **''確認''&aname(E); [#q4ed3167] 後はブラウザにProxy設定をして確認します。⇒[[Windows/Proxy]]~ これ⇒[[診断君>http://taruo.net/e/]]でチェックしてみました。 **''キャッシュクリア''&aname(F); [#hc429dd8] ■下記の手順でキャッシュクリアできます。起動シェルなどに組み込んだ方がいいかもしれません。~ # /usr/local/etc/rc.d/squid stop # rm -rf /usr/local/squid/cache/* # squid -z # /usr/local/etc/rc.d/squid start **''ログローテート''&aname(G); [#i164c8fa] ■squidのログローテートは下記のコマンドで行います。 # /usr/local/sbin/squid -k rotate ■cronに設定しておく(月に一回ローテートする設定例) 0 0 1 * * /usr/local/bin/sudo /usr/local/sbin/squid -k rotate **''キャッシュさせたくない場合''&aname(H); [#z0972979] ■/usr/local/etc/squid/squid.confでno_cashで指定する。 # vi /usr/local/etc/squid/squid.conf ------------------例--------------------- acl QUERY1 urlpath_regex cgi-bin \? no_cache deny QUERY1 ↑cgi-bin ?を含むURLをキャッシュしない acl SERVER1 dstdomain www.flateight.com no_cache deny SERVER1 ↑www.flateight.comのドメインをキャッシュしない no_cac acl QUERY2 url_regex yahoo\.co\.jp no_cache deny QUERY2 ↑yahoo.co.jpを含むURLをキャッシュしない -------------------例-------------------- 設定後は一回サービスをリスタートします。 **参考サイト [#rcc95cb2] http://www.ryuon.org/FreeBSD/install_manual/15.squid.txt **Basic認証の設定 [#y39dd10a] ***パスワードの設定 [#tb4b583d] Apacheのhtpasswdを使用します。プログラムのディレクトリと、パスワードファイルの保存先は適宜 # htpasswd -c /usr/local/squid/passwd username ***squid.confの編集 [#t2cd8251] 下記を設定します。auth_paramのディレクトリは適宜。http_accessのallow設定では、ネットワークのallow設定(例:http_access allow mylocal)はコメントアウトしておく。 # TAG: auth_param auth_param basic program /usr/local/libexec/squid/ncsa_auth /usr/local/etc/squid/passwd # TAG: acl acl password proxy_auth REQUIRED # TAG: http_access http_access allow password
タイムスタンプを変更しない
*&SIZE(15){''squid【スクイッド】''}; [#sc1102c5] [[dokuwiki.fl8.jp掲載済>http://dokuwiki.fl8.jp/02_freebsd/01_net/06_squid]] スクイッドと読むらしいですね。日本語訳するとヤリイカの事だそうです。~ squidでプロキシキャッシュサーバを作成してみたいと思います。~ #contents **''環境''&aname(A); [#re0c4012] FreeBSD 6.0~ squid 2.5~ ~ **''インストール''&aname(B); [#ba9decf1] # cd /usr/ports/www/squid # make install clean ;rehash ~ **''/usr/local/etc/squid/squid.confを設定''&aname(C); [#m91013cd] ログディレクトリとキャッシュディレクトリを変更しました。 no_cache deny QUERY cache_dir ufs /work/squid 100 16 256 ↑cacheフォルダの場所指定/キャッシュ容量/サブフォルダ数/更にサブフォルダ数 cache_log /var/squid/cache.log cache_store_log /var/squid/store.log pid_filename /var/run/squid/squid.pid auth_param basic children 5 auth_param basic realm Squid proxy-caching web server auth_param basic credentialsttl 2 hours auth_param basic casesensitive off refresh_pattern ^ftp: 1440 20% 10080 refresh_pattern ^gopher: 1440 0% 1440 refresh_pattern . 0 20% 4320 acl all src 0.0.0.0/0.0.0.0 acl manager proto cache_object acl localhost src 127.0.0.1/255.255.255.255 acl to_localhost dst 127.0.0.0/8 acl SSL_ports port 443 563 acl Safe_ports port 80 # http acl Safe_ports port 21 # ftp acl Safe_ports port 443 563 # https, snews acl Safe_ports port 70 # gopher acl Safe_ports port 210 # wais acl Safe_ports port 1025-65535 # unregistered ports acl Safe_ports port 280 # http-mgmt acl Safe_ports port 488 # gss-http acl Safe_ports port 591 # filemaker acl Safe_ports port 777 # multiling http acl CONNECT method CONNECT acl private src 192.168.1.0/255.255.255.0 http_access allow manager localhost http_access allow private http_access deny manager http_access deny !Safe_ports http_access deny CONNECT !SSL_ports http_access deny all http_reply_access allow all icp_access allow all header_access Cache-Control deny all header_access Via deny all header_access X-Forwarded-For deny all header_access Server deny all header_access User-Agent deny all header_access Accept allow all header_replace User-Agent Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0) coredump_dir /var/log/squid **runディレクトリとlogディレクトリ作成 [#r9e5a070] # mkdir /var/run/squid # chmod squid:wheel /var/run/squid # mkdir /var/log/squid # chmod squid:wheel /var/log/squid **''起動''&aname(D); [#reb2a08b] ■squid.conf修正後、下記のコマンドでキャッシュディレクトリを作成する。 # squid -z ■起動シェルにて起動。 # /usr/local/etc/rc.d/squid start **''確認''&aname(E); [#q4ed3167] 後はブラウザにProxy設定をして確認します。⇒[[Windows/Proxy]]~ これ⇒[[診断君>http://taruo.net/e/]]でチェックしてみました。 **''キャッシュクリア''&aname(F); [#hc429dd8] ■下記の手順でキャッシュクリアできます。起動シェルなどに組み込んだ方がいいかもしれません。~ # /usr/local/etc/rc.d/squid stop # rm -rf /usr/local/squid/cache/* # squid -z # /usr/local/etc/rc.d/squid start **''ログローテート''&aname(G); [#i164c8fa] ■squidのログローテートは下記のコマンドで行います。 # /usr/local/sbin/squid -k rotate ■cronに設定しておく(月に一回ローテートする設定例) 0 0 1 * * /usr/local/bin/sudo /usr/local/sbin/squid -k rotate **''キャッシュさせたくない場合''&aname(H); [#z0972979] ■/usr/local/etc/squid/squid.confでno_cashで指定する。 # vi /usr/local/etc/squid/squid.conf ------------------例--------------------- acl QUERY1 urlpath_regex cgi-bin \? no_cache deny QUERY1 ↑cgi-bin ?を含むURLをキャッシュしない acl SERVER1 dstdomain www.flateight.com no_cache deny SERVER1 ↑www.flateight.comのドメインをキャッシュしない no_cac acl QUERY2 url_regex yahoo\.co\.jp no_cache deny QUERY2 ↑yahoo.co.jpを含むURLをキャッシュしない -------------------例-------------------- 設定後は一回サービスをリスタートします。 **参考サイト [#rcc95cb2] http://www.ryuon.org/FreeBSD/install_manual/15.squid.txt **Basic認証の設定 [#y39dd10a] ***パスワードの設定 [#tb4b583d] Apacheのhtpasswdを使用します。プログラムのディレクトリと、パスワードファイルの保存先は適宜 # htpasswd -c /usr/local/squid/passwd username ***squid.confの編集 [#t2cd8251] 下記を設定します。auth_paramのディレクトリは適宜。http_accessのallow設定では、ネットワークのallow設定(例:http_access allow mylocal)はコメントアウトしておく。 # TAG: auth_param auth_param basic program /usr/local/libexec/squid/ncsa_auth /usr/local/etc/squid/passwd # TAG: acl acl password proxy_auth REQUIRED # TAG: http_access http_access allow password
テキスト整形のルールを表示する
ログインまたはアカウント作成