以下はこのサーバでの設定。192.244.xxx.yyy はこのサーバのIPアドレス。ネットワークは 192.244.xxx.0/24
# ipfw list
00100 allow ip from any to any via lo0
00200 deny ip from any to 127.0.0.0/8
00300 deny ip from 127.0.0.0/8 to any
00400 allow tcp from any to any established
00500 allow ip from any to any frag
00600 allow tcp from any to 192.244.xxx.yyy dst-port 22 setup
00700 allow tcp from any to 192.244.xxx.yyy dst-port 80 setup
00800 allow tcp from any to 192.244.xxx.yyy dst-port 443 setup
00900 allow ip from any to any out keep-state
01000 allow ip from 192.244.xxx.yyy to any keep-state
01100 allow tcp from 192.244.xxx.yyy to any setup
01200 deny tcp from any to any setup
01300 allow udp from 192.244.xxx.yyy to any dst-port 123 keep-state
01400 allow icmp from 192.244.xxx.0/24 to 192.244.xxx.yyy icmptypes 8
01500 allow icmp from 192.244.xxx.yyy to 192.244.xxx.0/24 icmptypes 0
01600 allow icmp from 192.244.xxx.yyy to any icmptypes 8
01700 allow icmp from any to 192.244.xxx.yyy icmptypes 0
01800 allow icmp from any to any icmptypes 3
65535 deny ip from any to any
% cd /usr/ports/www/apacheXX
# make; make install; make package
% cd /usr/ports/japanese/gd
# make; make install; make package
% cd /usr/ports/databases/mysqlXX-client
# make WITH_CHARSET=utf-8 WITH_XCHARSET=all BUILD_OPTIMIZED=yes BUILD_STATIC=yes install
% cd /usr/ports/databases/mysqlXX-server
# make WITH_CHARSET=utf-8 WITH_XCHARSET=all BUILD_OPTIMIZED=yes BUILD_STATIC=yes install
/etc/my.cnf に以下の設定
[client]
default-character-set = utf8
[mysqld]
skip-character-set-client-handshake
default-character-set = utf8
character-set-server = utf8
collation-server = utf8_general_ci
init-connect = SET NAMES utf8
[mysqldump]
default-character-set = utf8
[mysql]
default-character-set = utf8
そして
# /usr/local/share/mysql/mysql.server start
# /usr/local/share/mysql/mysql.server stop
で、権限の設定
% mysql -u root -p
全権限
> grant all privileges on database.* to user@host identified by 'password';
各権限
> grant select, insert, update, delete, create, drop on database.* to user@host identified by 'password';
> grant file on *.* to user@host identified by 'password';
file の権限は *.* に対して設定しなければならない、らしい。権限を剥奪するときは grant の代わりに revoke を用いる。
権限を確認するには
> show grants for user@host;
% cd /usr/ports/lang/phpXX
# vi Makefile
CONFIGURE_ARGS に次を追加する。(SSLは file 関数などで https:// から始まるリソースを取ってくるのに必要)
--with-pcre-regex=/usr/local \
--enable-session \
--enable-pcntl \
--enable-mbstring \
--with-xml \
--with-apxs=/usr/local/sbin/apxs \
--with-gd \
--with-ttf \
--with-freetype-dir=/usr/local \
--with-jpeg-dir=/usr/local/lib/ \
--with-png=/usr/local/lib/ \
--with-zlib-dir=/usr/lib/ \
--with-mysql=/usr/local/lib/mysql \
--with-openssl=/usr/local \
そして
# make; make install; make package
以下のコマンドでSSLに対応したか確認する。
% php -i | grep -i 'Stream Socket'
% cd /usr/ports/textproc/php5-xml
# make install
% cd /usr/ports/devel/pear
# make ; make install
↓使用例
# pear install --onlyreqdeps Net_POP3
もちろんOS Xです。Tigerです。新しいのにしたい。
./configure \
--prefix=/usr/local \
--enable-session \
--enable-cli \
--enable-mbstring \
--enable-mbregex \
--enable-zend-multibyte \
--with-xml \
--with-apxs \
--with-gd \
--with-ttf \
--with-freetype-dir=/usr/local/lib \
--with-jpeg-dir=/usr/local \
--with-png-dir=/usr/local \
--with-tiff-dir=/usr/local \
--with-mysql=/usr/local/mysql
/etc/ftpusers にアクセスさせたくないユーザ名を書く。あるいは特定のユーザと場所のみ許可するには次のように書く。許可したい場所に書く allow と最後の行の * は重要。
user@host.com allow
*
次に /etc/ftpchroot を編集して、ホームディレクトリより上を覗けないようにする。次のように書くと eroihito だけがホームディレクトリより上を覗ける。
eroihito
*
/etc/inetd.conf の次の行をコメントアウトして再起動。
ftp stream tcp nowait root /usr/libexec/tcpd ftpd -l