July 21, 2003

apache + ssl + php

準備

apache_1.3.28.tar.gz
from http://httpd.apache.org/dist/httpd/apache_1.3.28.tar.gz
mod_ssl-2.8.15-1.3.28.tar.gz
from http://www.modssl.org/source/mod_ssl-2.8.15-1.3.28.tar.gz
openssl-0.9.7b.tar.gz
from http://www.openssl.org/source/openssl-0.9.7b.tar.gz
php-4.3.3RC1.tar.gz
from http://www.php.net

解壓全部

cd openssl-0.9.7b
./config -fPIC
make
make install

cd ../mod_ssl-2.8.15-1.3.28
./configure --with-apache=../apache_1.3.28 --with-ssl=../openssl-0.9.7b --prefix=/usr/local/apache

cd ../apache_1.3.28
./configure --prefix=/usr/local/apache --sysconfdir=/usr/local/apache/conf --enable-module=so \
--enable-shared=ssl --enable-module=ssl --enable-module=rewrite --enable-shared=rewrite
make
make certificate
選 DSA
Country Name 選 TW
Certificate Validity 填一個夠長的時間, 如 1000 (天)
Certificate Version 選 3
其他選項就不是很重要
Encrypt the private key now? [Y/n] 選 n 啟動時才不用輸入密碼
make install

cd ../php-4.3.3RC1
./configure --with-mysql --with-apxs=/usr/local/apache/bin/apxs --enable-module=so \
--with-config-file-path=/usr/local/etc --libexecdir=/usr/local/apache/libexec
make install

cp .libs/libphp4.so /usr/local/apache/libexec
複製編好的 php so 檔到 apache libexec 目錄下

修改 httpd.conf
新增
LoadModule php4_module libexec/libphp4.so
LoadModule ssl_module libexec/libssl.so
AddModule mod_php4.c
AddModule mod_ssl.c

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

加入 register_globals = On 到 php.ini
echo "register_globals = On" >> /usr/local/lib/php.ini

啟動 /usr/local/apache/bin/apachectl startssl

Posted by pank at July 21, 2003 11:48 AM
Comments
Post a comment













Remember personal info?