CentOS5.3 ProFTPD ソースからインストール

CentOS5.3でyumコマンドによるProFTPDのインストールできなくなっていた。
なぜだ。

そして
http://dag.wieers.com/rpm/packages/proftpd/
からRPMパッケージもダウンロードできない。
なぜだ。

といってても進まないのでソースからインストールすることに。

■vsftpd停止
vsftpdがインストールされてれば停止
/sbin/service vsftpd stop
chkconfig –level 0123456 vsftpd off

■カレント移動
cd /usr/local/src

■ダウンロード
ftp://ftp.proftpd.org/distrib/source/
から任意のバージョンをダウンロード
wget ftp://ftp.proftpd.org/distrib/source/proftpd-1.3.2rc4.tar.gz

■展開/カレント移動
tar zxvf proftpd-1.3.2rc4.tar.gz
cd proftpd-1.3.2rc4

■configure
./configure –prefix=/usr/local/proftpd-1.3.2rc4 –with-modules=mod_tls

□–prefix
インストール先ディレクトリ
/usr/local/proftpdでもいいと思うが念のため/usr/local/proftpd-1.3.2rc4
とした。

□–with-modules
SSL/TLS 通信を有効

■インストール
make
make install

■シンボリックリンク作成
/usr/local/proftpdでアクセス可能とする
ln -sfn /usr/local/proftpd-1.3.2rc4 /usr/local/proftpd

■設定
vi /usr/local/proftpd-1.3.2rc4/etc/proftpd.conf
を任意編集

ServerType inetd
とする場合は以下も実施。

■xinetd.d経由で起動
vi /etc/xinetd.d/ftp
としてファイル作成。内容は以下。

service ftp
{
disable = no
socket_type = stream
protocol = tcp
wait = no
user = root
server = /usr/local/proftpd/sbin/in.proftpd
}

Postfix サブミッションポート

master.cfを編集
※コメントアウト部分を有効にする
※smtp認証導入済とする
※編集後リロード

編集前
smtp inet n – n – – smtpd
#submission inet n – n – – smtpd
# -o smtpd_enforce_tls=yes
# -o smtpd_sasl_auth_enable=yes
# -o smtpd_client_restrictions=permit_sasl_authenticated,reject

編集後
smtp inet n – n – – smtpd
submission inet n – n – – smtpd
# -o smtpd_enforce_tls=yes
-o smtpd_sasl_auth_enable=yes
-o smtpd_client_restrictions=permit_sasl_authenticated,reject

・送信できない場合はiptablesを確認
・/etc/servicesのsubmissionを確認

Apache2.0文字化け

centOSのApache2.0のhttpd.confを見ると、
AddDefaultCharset UTF-8
となっているので、
HTML文書がutf-8でない場合文字化けする場合がある。

同サーバのHTML文書の文字コードが多種な場合、
AddDefaultCharset off
又はコメントアウトして、
HTML文書のmetaタグに頼る。

一種ならHTML文書の文字コードに合わせて、
AddDefaultCharset shift_jis
などと設定する。

もちろん、バーチャルホストごとに指定するのもあり。
その場合、.htaccessで設定する手もある。

CentOS5.2:PHP5.2.9 ソースインストール

yumで入れたPHP5.1上でSQLiteを使おうとしたらエラーとなり、phpinfo()をみたら「–without-sqlite」。
ありえん。
しょうがないのでソースから再度インストールすることに。
ついでにfreetypeとか使いそうなオプションも付加。

■必要パッケージインストール
configureでnot foundなどでエラーとなるパッケージを思う様インストール

yum -y install gcc
yum -y install httpd-devel
yum -y install libxml2-devel
yum -y install bzip2-devel
yum -y install curl-devel
yum -y install gmp-devel
yum -y install mysql-devel
yum -y install postgresql-devel
yum -y install libjpeg-devel
yum -y install libpng-devel
yum -y install freetype-devel
yum -y install libmcrypt-devel
yum -y install unixODBC-devel
yum -y install pspell-devel
yum -y install libtool-ltdl-devel
yum -y –enablerepo=rpmforge install t1lib t1lib-devel

■PHPインストール

./configure \
–with-openssl \
–with-freetype-dir=/usr \
–with-mysql \
–with-pgsql \
–enable-calendar \
–enable-exif \
–enable-ftp \
–enable-mbregex \
–enable-mbstring \
–enable-shmop \
–enable-sockets \
–enable-sysvmsg \
–enable-sysvsem \
–enable-sysvshm \
–enable-wddx \
–enable-zend-multibyte \
–prefix=/usr \
–with-apxs2 \
–with-bz2 \
–with-config-file-path=/etc \
–with-gettext \
–with-iconv \
–with-mcrypt \
–with-mime-magic=/usr/share/file/magic.mime \
–with-gd \
–with-jpeg-dir=/usr \
–with-zlib \
–enable-gd-jis-conv \
–enable-gd-native-ttf \
–with-t1lib \
–with-ttf \
–with-ldap \
–enable-dba \
–with-db4 \
–program-prefix= \
–exec-prefix=/usr \
–bindir=/usr/bin \
–sbindir=/usr/sbin \
–sysconfdir=/etc \
–datadir=/usr/share \
–includedir=/usr/include \
–libdir=/usr/lib \
–libexecdir=/usr/libexec \
–localstatedir=/var \
–sharedstatedir=/usr/com \
–mandir=/usr/share/man \
–infodir=/usr/share/info \
–cache-file=../config.cache \
–with-pic \
–with-gmp \
–with-curl \
–with-exec-dir=/usr/bin \
–without-gdbm \
–with-pspell \
–with-layout=GNU \
–with-kerberos \
–with-unixODBC=/usr \
–enable-magic-quotes \
–enable-ucd-snmp-hack \

make
make install

■httpd.conf編集&再起動
vi /etc/httpd/conf/httpd.conf

module php5_module is already loaded, skipping
をコメントアウト

/etc/rc.d/init.d/httpd restart

CakePHP で静的なページを作成する方法

静的なページというかモデルを使用しないページを作成する場合。

app/config/routes.php に記述することで任意のコントローラーやアクションを実行したりビューを表示したりできる。


書式は、
$Route->connect (‘URL’,array(‘controller’=>’controllername’,’action’=>’actionname’, ‘firstparam’));


これにより特定のURLに対して静的?な表示用のコントローラーやアクションを実行し、またビューを表示する。


デフォルトでドキュメントルート(/)へのアクセスや、pagesディレクトリ(/pages/hoge)へのアクセスについて記述されている。

$Route->connect(‘/’, array(‘controller’ => ‘pages’, ‘action’ => ‘display’, ‘home’));
// 「/」 へのアクセスでpagesコントローラーとdisplayアクションを実行、homeビューを表示

$Route->connect(‘/pages/*’, array(‘controller’ => ‘pages’, ‘action’ => ‘display’));
// 「/pages/hoge」 へのアクセスでpagesコントローラーとdisplayアクションを実行、URLよりhogeビューを表示


静的ページを作成する場合、/pages/ 配下へビューファイルを配置してもよいし、
新たに、URLに /static/* などと指定しつつ追記することも可能。

CakePHP インストール

以下のような構成で public_html が Documentroot となっているとする。

└ Webroot/
    └ public_html/

——————————
1.
CakePHPの各ファイルを以下のように配置。

└ Webroot/
    ├ cake/
    ├ app/
    ├ vendors/
    └ public_html/

——————–
2.
app/webroot/ 以下の全ファイルをここにコピー。

——————–
3.
2でコピーした index.php 内の 定数「ROOT」と「APP_DIR」を書き換える。

define(‘ROOT’, ‘/path/to/Webroot’);
define(‘APP_DIR’, ‘app’);

——————–
4.
app/config/database.php.default を app/config/database.php としてコピー。
データベースの設定情報を編集する。

5.
app/tmp 以下に書き込み権を与える