検索

カレンダー

2012年5月
« 4月    
 123456
78910111213
14151617181920
21222324252627
28293031  

広告

ブログランキング・にほんブログ村へ
にほんブログ村

東電電力供給情報

カテゴリー

最近のコメント

リンク

squid キャッシュストレージをCOSSに変更してみる

投稿者:yasu 更新日時:2010年10月6日 12時13分44秒
カテゴリCentOS, Squid

Squid/キャッシュストレージとして COSS を使う - maruko2 Note.
上記ページにも記載されているようにsquidはページキャッシュを1オブジェクト(1ページとイコール?)1ファイルで保持するらしいのだが、ディスクI/Oの負荷が高いため1ファイルでまとめて管理可能なCOSSタイプに変更してみます。
とはいっても、上記ページに書いてある事をそのままやっただけで、かつ体感で早くなったとかはなく気分の問題って気もする。

[root@centos ~]# vi /etc/squid/squid.conf

# TAG: cache_dir
# Usage:
#
# cache_dir Type Directory-Name Fs-specific-data [options]
#
# You can specify multiple cache_dir lines to spread the
# cache among different disk partitions.
#
# Type specifies the kind of storage system to use. Only "ufs"
# is built by default. To enable any of the other storage systems
# see the --enable-storeio configure option.
#
# 'Directory' is a top-level directory where cache swap
# files will be stored. If you want to use an entire disk
# for caching, this can be the mount-point directory.
# The directory must exist and be writable by the Squid
# process. Squid will NOT create this directory for you.
# Only using COSS, a raw disk device or a stripe file can
# be specified, but the configuration of the "cache_swap_log"
# tag is mandatory.
#
# The ufs store type:
#
# "ufs" is the old well-known Squid storage format that has always
# been there.
#
# cache_dir ufs Directory-Name Mbytes L1 L2 [options]
#
# 'Mbytes' is the amount of disk space (MB) to use under this
# directory. The default is 100 MB. Change this to suit your
# configuration. Do NOT put the size of your disk drive here.
# Instead, if you want Squid to use the entire disk drive,
# subtract 20% and use that value.
#
# 'Level-1' is the number of first-level subdirectories which
# will be created under the 'Directory'. The default is 16.
#
# 'Level-2' is the number of second-level subdirectories which
# will be created under each first-level directory. The default
# is 256.
#
# The aufs store type:
#
# "aufs" uses the same storage format as "ufs", utilizing
# POSIX-threads to avoid blocking the main Squid process on
# disk-I/O. This was formerly known in Squid as async-io.
#
# cache_dir aufs Directory-Name Mbytes L1 L2 [options]
#
# see argument descriptions under ufs above
#
# The diskd store type:
#
# "diskd" uses the same storage format as "ufs", utilizing a
# separate process to avoid blocking the main Squid process on
# disk-I/O.
#
# cache_dir diskd Directory-Name Mbytes L1 L2 [options] [Q1=n] [Q2=n]
#
# see argument descriptions under ufs above
#
# Q1 specifies the number of unacknowledged I/O requests when Squid
# stops opening new files. If this many messages are in the queues,
# Squid won't open new files. Default is 64
#
# Q2 specifies the number of unacknowledged messages when Squid
# starts blocking. If this many messages are in the queues,
# Squid blocks until it receives some replies. Default is 72
#
# When Q1 < Q2 (the default), the cache directory is optimized
# for lower response time at the expense of a decrease in hit
# ratio. If Q1 > Q2, the cache directory is optimized for
# higher hit ratio at the expense of an increase in response
# time.
#
# The coss store type:
#
# block-size=n defines the "block size" for COSS cache_dir's.
# Squid uses file numbers as block numbers. Since file numbers
# are limited to 24 bits, the block size determines the maximum
# size of the COSS partition. The default is 512 bytes, which
# leads to a maximum cache_dir size of 512<<24, or 8 GB. Note
# you should not change the COSS block size after Squid
# has written some objects to the cache_dir.
#
# overwrite-percent=n defines the percentage of disk that COSS
# must write to before a given object will be moved to the
# current stripe. A value of "n" closer to 100 will cause COSS
# to waste less disk space by having multiple copies of an object
# on disk, but will increase the chances of overwriting a popular
# object as COSS overwrites stripes. A value of "n" close to 0
# will cause COSS to keep all current objects in the current COSS
# stripe at the expense of the hit rate. The default value of 50
# will allow any given object to be stored on disk a maximum of
# 2 times.
#
# max-stripe-waste=n defines the maximum amount of space that COSS
# will waste in a given stripe (in bytes). When COSS writes data
# to disk, it will potentially waste up to "max-size" worth of disk
# space for each 1MB of data written. If "max-size" is set to a
# large value (ie >256k), this could potentially result in large
# amounts of wasted disk space. Setting this value to a lower value
# (ie 64k or 32k) will result in a COSS disk refusing to cache
# larger objects until the COSS stripe has been filled to within
# "max-stripe-waste" of the maximum size (1MB).
#
# membufs=n defines the number of "memory-only" stripes that COSS
# will use. When an cache hit is performed on a COSS stripe before
# COSS has reached the overwrite-percent value for that object,
# COSS will use a series of memory buffers to hold the object in
# while the data is sent to the client. This will define the maximum
# number of memory-only buffers that COSS will use. The default value
# is 10, which will use a maximum of 10MB of memory for buffers.
#
# maxfullbufs=n defines the maximum number of stripes a COSS partition
# will have in memory waiting to be freed (either because the disk is
# under load and the stripe is unwritten, or because clients are still
# transferring data from objects using the memory). In order to try
# and maintain a good hit rate under load, COSS will reserve the last
# 2 full stripes for object hits. (ie a COSS cache_dir will reject
# new objects when the number of full stripes is 2 less than maxfullbufs)
#
# The null store type:
#
# no options are allowed or required
#
# Common options:
#
# read-only, no new objects should be stored to this cache_dir
#
# min-size=n, refers to the min object size this storedir will accept.
# It's used to restrict a storedir to only store large objects
# (e.g. aufs) while other storedirs are optimized for smaller objects
# (e.g. COSS). Defaults to 0.
#
# max-size=n, refers to the max object size this storedir supports.
# It is used to initially choose the storedir to dump the object.
# Note: To make optimal use of the max-size limits you should order
# the cache_dir lines with the smallest max-size value first and the
# ones with no max-size specification last.
#
# Note that for coss, max-size must be less than COSS_MEMBUF_SZ
# (hard coded at 1 MB).
#
#Default:
#cache_dir ufs /var/spool/squid 200 16 256 ←先頭に#を追記してコメント化する
cache_dir COSS /var/spool/squid/coss 100 max-size=1048576 ←追記する

# TAG: cache_swap_state
# Location for the cache "swap.state" file. This index file holds
# the metadata of objects saved on disk. It is used to rebuild
# the cache during startup. Normally this file resides in each
# 'cache_dir' directory, but you may specify an alternate
# pathname here. Note you must give a full filename, not just
# a directory. Since this is the index for the whole object
# list you CANNOT periodically rotate it!
#
# If %s can be used in the file name it will be replaced with a
# a representation of the cache_dir name where each / is replaced
# with '.'. This is needed to allow adding/removing cache_dir
# lines when cache_swap_log is being used.
#
# If have more than one 'cache_dir', and %s is not used in the name
# these swap logs will have names such as:
#
# cache_swap_log.00
# cache_swap_log.01
# cache_swap_log.02
#
# The numbered extension (which is added automatically)
# corresponds to the order of the 'cache_dir' lines in this
# configuration file. If you change the order of the 'cache_dir'
# lines in this file, these index files will NOT correspond to
# the correct 'cache_dir' entry (unless you manually rename
# them). We recommend you do NOT use this option. It is
# better to keep these index files in each 'cache_dir' directory.
#
#Default:
# none
cache_swap_log /var/spool/squid/cache_swap_log ←追記する

ファイルを保存しviエディタを終了します

COSSキャッシュストレージの作成

COSSキャッシュストレージを作成します。

#サービスを停止しないと作成できないのでsquidを停止します
[root@centos ~]# /etc/rc.d/init.d/squid stop
squid を停止中: ................ [ OK ]

#COSSキャッシュストレージを作成します
[root@centos ~]# squid -z
2010/10/04 16:05:54| Creating Swap Directories

#サービスを起動します
[root@centos ~]# /etc/rc.d/init.d/squid start
init_cache_dir /var/spool/squid/coss... squid を起動中: . [ OK ]

これで設定完了です。

Windows Web Server 2008 R2が起動しなくなった

投稿者:yasu 更新日時:2010年7月6日 23時49分29秒
カテゴリCentOS, MySQL, Windows Web Server 2008 R2, WordPress, 自宅サーバー

夕方Google Analyticsで今日のページアクセス数を確認したらやたらアクセス数が少ないので、WordPressの状態でも確認しようと思ったら接続できなくなっていました。
たぶん熱暴走だと思いインストールマニアックス3の大会で借りているHyper-Vサーバーの電源を強制OFFして再起動したところ、Hyper-Vは起動するのですがWindows Web Server 2008 R2が起動しなくなってしまいました。

しかも最近ブログのバックアップもとっていないのにです(><)

ちょうど1ヶ月前にバックアップしたファイルが残っていたので、ひとまずCentOS上にリストアしてブログを表示できるようにはしましたが記事も1ヶ月はなくなってしまいました。

とりあえずWindows Web Server 2008 R2が復旧できないかもう少し調べていじってみたいと思います。

[CentOS5 で自宅サーバ] IPv6を無効にするには

投稿者:yasu 更新日時:2010年6月5日 10時54分15秒
カテゴリCentOS, 自宅サーバー

かなり今更感満載ではありますが、下記サイトを参考にCentOS5で構築した自宅サーバとNASサーバのIPv6を無効にしてみた。
れぶろぐ - [CentOS] CentOS 5 で IPv6 を本当に無効にする
poohSec » Blog Archive » CentOS 5 : IPv6 サーバでない場合は IPv6 を無効にする
centOS5でIPv6を無効化 | プログラムブログ

1./etc/sysconfig/network ファイルのNETWORKING_IPV6をnoに変更。
2./etc/modprobe.conf ファイルにalias ipv6 off と alias net-pf-10 off を追記。
3.システム再起動(IPv6が無効になる)
4.ifconfigやnetstat -anでIPv6のアドレスやIPv6といった表示がされていないことを確認

WordPressのバックアップとリストア

投稿者:yasu 更新日時:2010年6月3日 16時49分17秒
カテゴリCentOS, Linux, MySQL, Windows, Windows Web Server 2008 R2, WordPress, 自宅サーバー

当ブログは現在Windows Web Server 2008 R2にWordPressをインストールして稼働しています。
元々はCentOS5で稼働させていたのだけれど、インストールマニアックス3に応募して借りているサーバー機をタダでもらうにはWindows Web Server 2008 R2で構築したWebサーバーを80番ポートで1年間公開しないといけない。
1年公開し終わったらWordPressをCentOSの環境に戻したいと思っているので、今の内にWindowsからCentOSに戻る手順を確立しておこうかと思います。

Windows Web Server 2008 R2側の作業

MySQLのバックアップ

コマンドプロンプトからMySQLのバックアップを行います。

C:\Users\Administrator> mysqldump -B wordpress -h localhost -u root -p --opt -r wordpress.db.bak
Enter password: mysqlのrootユーザのパスワード

mysqldumpのオプション
-B wordpress・・・WordPressのデータベース名
-h localhost・・・WordPressデータベースがあるMySQLサーバーのサーバー名
-u root・・・MySQLのユーザ名
-p・・・上記ユーザのログインパスワード
--opt・・・オプション--add-drop-table --add-locks --create-options --disable-keys --extended-insert --lock-tables --quick --set-charsetと同等
-r wordpress.db.bak・・・Windowsの場合改行コードが\r\nになるのを防止する(Linuxに移行するので必要かと思った)

WordPressのバックアップ

エクスプローラからWordPressのバックアップを行います。
C:\inetpub\wwwroot\blog フォルダをblog.zipの名前でアーカイブします。
※上記WordPressフォルダ(C:\inetpub\wwwroot\blog)は各自の環境にあわせて読み替えてください

バックアップファイルの転送

wordpress.db.bakとblog.zipをCentOSの/rootディレクトリ(どこでもよいです)にコピーします。

CentOS 5 側の作業

WordPressをリストア

WordPressをリストアします。

WordPressのバックアップファイルを公開ディレクトリにコピーします
[root@centos ~]# cp blog.zip /var/www/html/

WordPressのバックアップファイルを解凍します
[root@centos ~]# unzip /var/www/html/blog.zip

WordPressフォルダ(ここでは名前がblogとなっていますがWordPressが入っています)の所有者を変更します
[root@centos ~]# chown -R apache.apache blog

WordPressのバックアップファイルを削除します
[root@centos ~]# rm -f /var/www/html/blog.zip

MySQLのリストア

MySQLをリストアします。

WordPressのデータベースをDrop/Createして新しく作り直します
[root@centos ~]# mysql -u root -p
Enter password: MySQLのrootユーザのパスワード
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 42
Server version: 5.0.77 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> drop database wordpress;
Query OK, 11 rows affected (0.13 sec)

mysql> create database wordpress;
Query OK, 1 row affected (0.05 sec)

mysql> grant all privileges on wordpress.* to wordpress@localhost identified by 'wordpressユーザのパスワード';
Query OK, 0 rows affected (0.02 sec)

mysql> exit
Bye

作り直したWordPress用データベースにデータをリストアします
[root@centos ~]# mysql -h localhost -u root -p wordpress < wordpress.db.bak
Enter password: MySQLのrootユーザのパスワード

リストアが正常に完了しているかテーブル一覧を確認します
[root@centos ~]# mysql -h localhost -D wordpress -u root -p
Enter password: MySQLのrootユーザのパスワード
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 67
Server version: 5.0.77 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show tables;

+-----------------------+
| Tables_in_wordpress   |
+-----------------------+
| wp_commentmeta        |
| wp_comments           |
| wp_links              |
| wp_options            |
| wp_postmeta           |
| wp_posts              |
| wp_term_relationships |
| wp_term_taxonomy      |
| wp_terms              |
| wp_usermeta           |
| wp_users              |
+-----------------------+

11 rows in set (0.00 sec)

これでCentOSにWordPressのリストアは完了です。

なお現状yasuの環境ですとCentOSは別のポートで公開しています。
このままですとCentOS側のWordPressのログインをしようとしてもWindows側のWordPressに飛んでいってしまうので、サイトURL設定を変更します。

mysql> select option_name, option_value from wp_options where option_name = 'siteurl' or option_name = 'home';

+-------------+-----------------------------+
| option_name | option_value                |
+-------------+-----------------------------+
| home        | http://www.sa-sa-ki.jp/blog |
| siteurl     | http://www.sa-sa-ki.jp/blog |
+-------------+-----------------------------+

2 rows in set (0.00 sec)

mysql> update wp_options set option_value = 'https://sa-sa-ki.jp:8443/blog' where option_name = 'siteurl';
mysql> update wp_options set option_value = 'https://sa-sa-ki.jp:8443/blog' where option_name = 'home';

これで別ポートで公開しているCentOS側のWordPressでログインできるようになりました。

[CentOS5で自宅サーバ]yum-utilsのpackage-cleanupで古いカーネルを削除する

投稿者:yasu 更新日時:2010年5月31日 17時53分40秒
カテゴリCentOS, 自宅サーバー

USBメモリにCentOS 5をインストールして作成したNASサーバのルート領域のサイズが40%近くのサイズになっているので、古いカーネルを削除してみることにした。

現在のディスクサイズを確認
[root@nas ~]# df -h
Filesystem サイズ 使用 残り 使用% マウント位置
/dev/sda1 5.3G 2.0G 3.1G 39% / ←これがUSBドライブ
/dev/md0 4.5T 900G 3.4T 21% /nas
tmpfs 1.6G 0 1.6G 0% /dev/shm

yum-utilsパッケージをインストール(インストール済みの場合は不要)
[root@nas ~]# yum -y install yum-utils
Loaded plugins: fastestmirror
Determining fastest mirrors
* addons: ftp.tsukuba.wide.ad.jp
* base: ftp.tsukuba.wide.ad.jp
* extras: ftp.tsukuba.wide.ad.jp
* updates: ftp.tsukuba.wide.ad.jp
addons | 951 B 00:00
addons/primary | 202 B 00:00
base | 1.1 kB 00:00
base/primary | 920 kB 00:00
base 2599/2599
extras | 2.1 kB 00:00
extras/primary_db | 180 kB 00:00
updates | 1.9 kB 00:00
updates/primary_db | 127 kB 00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package yum-utils.noarch 0:1.1.16-14.el5.centos.1 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================
Package Arch Version Repository Size
==========================================================================================
Installing:
yum-utils noarch 1.1.16-14.el5.centos.1 base 69 k

Transaction Summary
==========================================================================================
Install 1 Package(s)
Upgrade 0 Package(s)

Total download size: 69 k
Downloading Packages:
yum-utils-1.1.16-14.el5.centos.1.noarch.rpm | 69 kB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : yum-utils 1/1

Installed:
yum-utils.noarch 0:1.1.16-14.el5.centos.1

Complete!

package-cleanupで古いカーネルを削除します
[root@nas ~]# package-cleanup --oldkernels
Setting up yum
Not removing kernel 2.6.18-164.el5 because it is the running kernel
I will remove the following 4 kernel related packages:
kernel-2.6.18-164.11.1.el5
kernel-2.6.18-164.10.1.el5
kernel-devel-2.6.18-164.10.1.el5
kernel-devel-2.6.18-164.11.1.el5
Is this ok [y/N]: y

ディスクサイズを再確認
[root@nas ~]# df -h
Filesystem サイズ 使用 残り 使用% マウント位置
/dev/sda1 5.3G 1.8G 3.3G 36% / ←USBドライブ 200MB程容量が増えた
/dev/md0 4.5T 900G 3.4T 21% /nas
tmpfs 1.6G 0 1.6G 0% /dev/shm

200MBか。
もう少し効果があるとよかったんだけど。
NAS領域の容量も1TB近くデータがあるし、そろそろルート領域は16GBもしくは32GBのUSBメモリを2つ挿してミラーリングにしようかな。

CentOS 5.4→5.5 yum updateエラー解決

投稿者:yasu 更新日時:2010年5月18日 15時54分12秒
カテゴリCentOS, 自宅サーバー

CentOS 5.5がリリースされたと聞いたので自宅サーバーのCentOSのログを確認したところ、yum update時にエラーが出てました。

---> Package poppler.i386 0:0.5.4-4.4.el5_4.11 set to be updated
Trying other mirror.
Trying other mirror.
http://ftp.riken.jp/Linux/centos/5.5/extras/i386/repodata/filelists.xml.gz: [Errno -1] Metadata file does not match checksum
Trying other mirror.
http://ftp.nara.wide.ad.jp/pub/Linux/centos/5.5/extras/i386/repodata/filelists.xml.gz: [Errno -1] Metadata file does not match checksum
Trying other mirror.
http://ftp.jaist.ac.jp/pub/Linux/CentOS/5.5/extras/i386/repodata/filelists.xml.gz: [Errno -1] Metadata file does not match checksum
Trying other mirror.
http://centos.ustc.edu.cn/centos/5.5/extras/i386/repodata/filelists.xml.gz: [Errno -1] Metadata file does not match checksum
Trying other mirror.
http://mirror.averse.net/centos/5.5/extras/i386/repodata/filelists.xml.gz: [Errno -1] Metadata file does not match checksum
Trying other mirror.
http://mirror.nus.edu.sg/centos/5.5/extras/i386/repodata/filelists.xml.gz: [Errno 4] Socket Error: timed out
Trying other mirror.
http://ftp.yz.yamagata-u.ac.jp/pub/linux/centos/5.5/extras/i386/repodata/filelists.xml.gz: [Errno -1] Metadata file does not match checksum
Trying other mirror.
ftp://ftp.oss.eznetsols.org/linux/centos/5.5/extras/i386/repodata/filelists.xml.gz: [Errno -1] Metadata file does not match checksum
Trying other mirror.
Error: failure: repodata/filelists.xml.gz from extras: [Errno 256] No more mirrors to try.
You could try using --skip-broken to work around the problem
You could try running: package-cleanup --problems
package-cleanup --dupes
rpm -Va --nofiles --nodigest
The program package-cleanup is found in the yum-utils package.

ちなみにこれ、yum clean allを実施してからyum updateをしたらエラーが解決しました。

CentOS5.4にSquidを導入

投稿者:yasu 更新日時:2010年5月16日 0時42分58秒
カテゴリCentOS, Squid

自宅サーバーのCentOS 5.4にプロキシサーバーであるSquidをインストールしました。
Squid cache - Wikipedia

rootユーザにスイッチします
[centos@centos ~]$ su -
パスワード:rootユーザのパスワード

Squidをインストールします
[root@centos ~]# yum -y install squid
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* addons: ftp.iij.ad.jp
* base: ftp.iij.ad.jp
* extras: ftp.iij.ad.jp
* updates: ftp.iij.ad.jp
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package squid.i386 7:x.x.STABLExx-x.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
squid i386 7:x.x.STABLExx-x.el5 base 1.3 M

Transaction Summary
================================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 1.3 M
Downloading Packages:
squid-x.x.STABLExx-x.el5.i386.rpm | 1.3 MB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : squid 1/1

Installed:
squid.i386 7:x.x.STABLExx-x.el5

Complete!

Squidの設定を行います。

Squidの設定ファイルを開きます
[root@centos ~]# vi /etc/squid/squid.conf

viエディタが起動するので、下記のように追加・変更します

#Recommended minimum configuration:
acl localhost src 127.0.0.1/255.255.255.255
ローカルネットワークに別名を付与します
acl lan src 192.168.0.0/255.255.255.0

# And finally deny all other access to this proxy
http_access allow localhost
別名を付与したローカルネットワークにアクセス許可設定を行います
http_access allow lan
http_access deny all

# TAG: forwarded_for on|off
# If set, Squid will include your system's IP address or name
# in the HTTP requests it forwards. By default it looks like
# this:
#
# X-Forwarded-For: 192.1.2.3
#
# If you disable this, it will appear as
#
# X-Forwarded-For: unknown
#
#Default:
# forwarded_for on
プロキシサーバーを使用している端末のローカルIPアドレスを隠す為、off設定します
forwarded_for off

# TAG: visible_hostname
# If you want to present a special hostname in error messages, etc,
# 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 sa-sa-ki.jp

# TAG: header_access
# Usage: header_access header_name allow|deny [!]aclname ...
#
# WARNING: Doing this VIOLATES the HTTP standard. Enabling
# this feature could make you liable for problems which it
# causes.
#
# This option replaces the old 'anonymize_headers' and the
# older 'http_anonymizer' option with something that is much
# more configurable. This new method creates a list of ACLs
# for each header, allowing you very fine-tuned header
# mangling.
#
# You can only specify known headers for the header name.
# Other headers are reclassified as 'Other'. You can also
# refer to all the headers with 'All'.
#
# For example, to achieve the same behavior as the old
# 'http_anonymizer standard' option, you should use:
#
# header_access From deny all
# header_access Referer deny all
# header_access Server deny all
# header_access User-Agent deny all
# header_access WWW-Authenticate deny all
# header_access Link deny all
#
# Or, to reproduce the old 'http_anonymizer paranoid' feature
# you should use:
#
# header_access Allow allow all
# header_access Authorization allow all
# header_access WWW-Authenticate allow all
# header_access Proxy-Authorization allow all
# header_access Proxy-Authenticate allow all
# header_access Cache-Control allow all
# header_access Content-Encoding allow all
# header_access Content-Length allow all
# header_access Content-Type allow all
# header_access Date allow all
# header_access Expires allow all
# header_access Host allow all
# header_access If-Modified-Since allow all
# header_access Last-Modified allow all
# header_access Location allow all
# header_access Pragma allow all
# header_access Accept allow all
# header_access Accept-Charset allow all
# header_access Accept-Encoding allow all
# header_access Accept-Language allow all
# header_access Content-Language allow all
# header_access Mime-Version allow all
# header_access Retry-After allow all
# header_access Title allow all
# header_access Connection allow all
# header_access Proxy-Connection allow all
# header_access All deny all
#
# By default, all headers are allowed (no anonymizing is
# performed).
#
#Default:
# none
プロキシサーバーからのアクセスである事を隠します
header_access X-Forwarded-For deny all
header_access Via deny all
header_access Cache-Control deny all

[:]キー、[w]キー、[q]キーを順に押下して内容を保存しviエディタを終了します

Squidサービスがローカルネットワーク内で利用できるようにファイアウォールの設定を変更します。

IPTablesの設定ファイルを開きます

[root@centos ~]# vi /etc/sysconfig/iptables

viエディタが起動するので、下記を追加します

# Firewall configuration written by system-config-securitylevel
# Manual customization of this file is not recommended.

~ 省略 ~

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3128 -j ACCEPT

~ 省略 ~

-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
COMMIT

[:]キー、[w]キー、[q]キーを順に押下して内容を保存しviエディタを終了します

ファイアウォールの設定を反映します。

[root@centos ~]# /etc/rc.d/init.d/iptables restart
ファイアウォールルールを適用中: [ OK ]
チェインポリシーを ACCEPT に設定中filter [ OK ]
iptables モジュールを取り外し中 [ OK ]
iptables ファイアウォールルールを適用中: [ OK ]
iptables モジュールを読み込み中ip_conntrack_netbios_ns [ OK ]

Squidのサービスを起動とOS再起動時の自動起動設定をします。

Squidのサービスを起動します
[root@centos ~]# /etc/rc.d/init.d/squid start
init_cache_dir /var/spool/squid... squid を起動中: .. [ OK ]

OS再起動時にSquidのサービスを自動起動するようにします
[root@centos ~]# chkconfig squid on
[root@centos sysconfig]# chkconfig --list squid
squid 0:off 1:off 2:on 3:on 4:on 5:on 6:off
※ランレベル2~5がonになっていればOK

次回はクライアントにプロキシの設定をします。

Provider encountered an error while streaming a multistatus PROPFIND response. [404, #0]

投稿者:yasu 更新日時:2010年4月9日 0時05分56秒
カテゴリApache, CentOS

会社のWindow XPから自宅のWebDavに接続ができない。
Snow LeopardやUbuntuからも接続はできるんだけど、ファイルの一覧が表示されない。
Apacheのログをみたら
Provider encountered an error while streaming a multistatus PROPFIND response. [404, #0]
って表示されてる。

んで、このメッセージでググってみました。
IT Harmony: Provider encountered an error while streaming a multistatus PROPFIND response
同じ現象で困っている方がいたので、その方のサイトを見てみると・・・

【現象】WebDAV 共有しているはずが、アクセスすると上記エラーによりアクセスできない。

≪理由≫Apache の仕様により 2GB 以上のファイルがあると上記エラーが発生し、ファイル一覧表示すらできないらしい。

最近2GBを超えるようなファイルをWebDav共有フォルダに置いた記憶はないのだが、不要なファイルやフォルダを整理したらWindowsからは接続できるようになったし、Snow LeopardやUbuntuからもファイルの一覧が表示されるようになった。

結論:WebDavには何でもつっこんではいけない

テキストの行末の^Mを削除するには

投稿者:yasu 更新日時:2010年4月8日 12時47分38秒
カテゴリCentOS, Linux, Ubuntu, Windows

Windowsで作ったWebアプリを自宅サーバーのCentOSにアップしてviでhtmlファイルを開いたところ、テキストの行末に^Mがついていた。
原因はWindowsとLinuxの改行コードの違いで、WindowsのCR+LFに対してLinuxはLFだけなのでCRが^Mという形で表示されてるみたい。
このままでも動作に問題はなさそうなんだけど、気持ち悪いので一括削除の方法を探してみたところ@ITにやり方がでてた。
テキストファイルの行末に^Mが表示される

viエディタでファイルを開いたら[:]キーを押してコマンドモードにして以下のように入力します。

%s/^M//g

^Mは制御キーなので[Ctrl]+[V]キーを押してから[Ctrl]+[M]キーを押します。
直接^Mとキー入力しても制御キーである^Mは変換できません。

CentOSアーカイブ

投稿者:yasu 更新日時:2010年4月4日 0時54分11秒
カテゴリCentOS

CentOS5.1のisoをダウンロードしたいんだけどって聞かれたのでメモ。

http://vault.centos.org/

こちらのサイトにはバージョン2.1から揃っているようなので、yasuも古いバージョンのCentOSのisoが必要に迫られたらここからダウンロードさせてもらうことにします。