Selasa, 15 Januari 2008

APACHE2-SSL-PHP5

OpenSSL Installation
# wget http://www.openssl.org/source/openssl-0.9.8e.tar.gz
# tar zxvf openssl-0.9.8e.tar.gz
# cd openssl-0.9.8e
# ./config
# make && make install

Apache Installation
# wget http://apache.cbn.net.id/httpd/httpd-2.2.4.tar.bz2
# tar jxvf httpd-2.2.4.tar.bz2
# cd httpd-2.2.
# ./configure --enable-ssl --with-ssl=/usr/local/ssl --enable-suexec --enable-so
# make && make install
# /usr/local/apache2/bin/apachectl start

Generate /usr/local/apache2/ssl.crt/server.crt
# mkdir /usr/local/apache2/ssl.crt
# /usr/local/ssl/bin/openssl genrsa -des3 -passout pass:asecretpassword -out /usr/local/apache2/ssl.crt/server.key.org 1024
# /usr/local/ssl/bin/openssl req -new -passin pass:asecretpassword -passout pass:asecretpassword -key /usr/local/apache2/ssl.crt/server.key.org -out /usr/local/apache2/ssl.crt/server.csr -days 3650
# /usr/local/ssl/bin/openssl req -x509 -passin pass:asecretpassword -passout pass:asecretpassword -key /usr/local/apache2/ssl.crt/server.key.org -in /usr/local/apache2/ssl.crt/server.csr -out /usr/local/apache2/ssl.crt/server.crt -days 3650
# /usr/local/ssl/bin/openssl rsa -passin pass:asecretpassword -in /usr/local/apache2/ssl.crt/server.key.org -out /usr/local/apache2/ssl.crt/server.key
# mkdir /usr/local/apache2/ssl.key
# mv /usr/local/apache2/ssl.crt/server.key /usr/local/apache2/ssl.key/server.key
# chmod 400 /usr/local/apache2/ssl.key/server.key
# cp /usr/local/apache2/ssl.crt/server.crt /usr/local/apache2/conf/
# cp /usr/local/apache2/ssl.key/server.key /usr/local/apache2/conf/

PHP Installation
# tar jxvf php-5.2.3.tar.bz2
# cd php-5.2.3
# ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --enable-track-vars --enable-sockets --enable-ftp --with-zlib --with-openssl=/usr/local/ssl --enable-force-cgi-redirect --enable-exif --with-gd --enable-memory-limit --disable-debug --disable-rpath --disable-static --with-pic --with-layout=GNU --enable-calendar --enable-sysvsem --enable-sysvshm --enable-sysvmsg --enable-trans-sid --enable-bcmath --with-bz2 --enable-ctype --with-db4 --with-iconv --enable-filepro --with-gettext --enable-mbstring --enable-shmop --enable-wddx --disable-xml --with-xmlrpc --enable-yp --with-zlib --without-pgsql --enable-dbx --enable-experimental-zts --without-mm --enable-gd-native-ttf --with-imap-ssl --enable-soap --enable-dbase --enable-xml
# make && make install
# cp php.ini-dist /usr/local/lib/php.ini

Apache Configuration
# vi /usr/local/apache2/conf/httpd.conf
Add these lines:

LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps

Uncomment line below:
# Include conf/extra/httpd-ssl.conf become:
Include conf/extra/httpd-ssl.conf

Then restart Apache:
# /usr/local/apache2/bin/apachetl start

Ceck PHP
# vi /usr/local/apache2/htdocs/info.php

phpinfo()
?>

Open your browser: http://ipaddress/info.php dan https://ipaddress/info.php

Tidak ada komentar: