Postfix Virtual

APACHE & PHP INSTALLATION

APACHE INSTALLATION

**Openssl installation is explained in Postfix Virtual Installation section. Please install openssl first and come here again.

$cd /usr/local/src
$wget -c http://www.apache.org/dist/httpd/httpd-2.0.53.tar.bz2
$tar -jxf httpd-2.0.53.tar.bz2
$cd httpd-2.0.53
$./configure --prefix=/usr/local/apache2 \
--enable-so --enable-ssl=shared --enable-rewrite=shared \
--with-ssl=/usr/local/ssl
$make
$su
#make install

Lets make directories and files secure

#cd /usr/local/apache2
#chown 0 . bin conf logs
#chgrp 0 . bin conf logs
#chmod 755 . bin conf logs
#chown 0 /usr/local/apache2/bin/httpd
#chgrp 0 /usr/local/apache2/bin/httpd
#chmod 511 /usr/local/apache2/bin/httpd

Apache Security:
    We should also prevent apache giving server version and type
information to the outside. By default apache gives information about its version
and some of application it uses. e.g php,openssl. We don't want to give this info
to the others right?

1)
Edit file:
/usr/local/apache2/conf/httpd.conf and find these two lines and modify them as below;
ServerTokens Prod
ServerSignature Off

2)
#UserDir public_html
Comment this UserDir line too.

Create SSL Certificate

#cd /usr/local/ssl/certs
#/usr/local/ssl/bin/openssl req -new > webmail.csr

{This command will ask you some questions for ssl certificate. The
important answer is for "Common Name" question. Your answer should be the web
page address where you will serve ssl site. e.g webmail.test.com, if you give another name
here, you will have CN mismacth problems in apache}

# /usr/local/ssl/bin/openssl rsa -in privkey.pem -out webmail.key
#/usr/local/ssl/bin/openssl x509 -in webmail.csr -out webmail.crt -req \ -signkey webmail.key -days 999
#mkdir /usr/local/apache2/conf/ssl.crt 
#mkdir /usr/local/apache2/conf/ssl.key
#cp webmail.key /usr/local/apache2/conf/ssl.key/ webmail.key
#cp webmail.crt /usr/local/apache2/conf/ssl.crt/ webmail.crt

Open /usr/local/apache2/conf/ssl.conf and convert lines below

SSLCertificateFile /usr/local/apache2/conf/ssl.crt/server.crt
SSLCertificateKeyFile /usr/local/apache2/conf/ssl.key/server.key

INTO >>>

SSLCertificateFile /usr/local/apache2/conf/ssl.crt/webmail.crt
SSLCertificateKeyFile /usr/local/apache2/conf/ssl.key/webmail.key

Start APACHE

#/usr/local/apache2/bin/apachectl startssl

ZLIB INSTALLATION

#cd /usr/local/src
#wget -c http://www.zlib.net/zlib-1.2.3.tar.gz
#tar -zxf zlib-1.2.3.tar.gz
#cd zlib-1.2.3
#./configure
#make
#make install

C-CLIENT (UW-IMAP)

#cd /usr/local/src
#wget -c ftp://ftp.cac.washington.edu/imap/imap.tar.Z
#tar -Zxf imap.tar.Z
#cd imap-2004c1
(YOUR DIRECTORY MAY BE DIFFERENT DEPENDING ON YOUR VERSION)
#make slx SSLTYPE=none
(Answer Y to the question asked when above command is issued)
#mkdir include
#mkdir lib
#cp c-client/*.h include/
#cp c-client/*.c lib/
#mv c-client/c-client.a lib/libc-client.a

 

PHP INSTALLATION

Libjpeg and Libpng packages have to be downloaded for the compilation of PHP to be done
without any problem.


Libjpeg Package(Dependency for PHP)

#cd /usr/local/src
#wget -c ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz
#tar zxf jpegsrc.v6b.tar.gz
#cd jpeg-6b
#./configure
#make
#make test
#make install
#make install-lib
#make install-headers

Libpng Package (Dependency for PHP)

#wget -c http://superb-west.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.10.tar.bz2
#tar jxf libpng-1.2.10.tar.bz2
#cd libpng-1.2.10
#cp scripts/makefile.linux Makefile
#make
#make install

PHP INSTALLATION

#cd /usr/local/src
#tar -jxf php-4.3.11.tar.bz2
#cd php-4.3.11
#./configure \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-mysql=/usr/local/mysql \
--enable-track-vars \
--with-openssl=/usr/local/ssl \
--with-imap= /usr/local/imap-2004c1 \
--with-gd \
--enable-ftp \
--enable-sysvsem \
--enable-sysvshm \
--enable-sockets \
--with-gettext \
--with-jpeg-dir=/usr/local \
--with-zlib-dir=/usr/local \
--enable-exif

#make
#make install
#cp php.ini-dist /usr/local/lib/php.ini

Add the lines written below to /usr/local/apache2/conf/httpd.conf. Where you place these lines doesn't make any difference actually but find other AddType paramaters in httpd.conf
and place these below those paramaters.

AddType application/x-httpd-php .php
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php .php3

Add also index.php   to DirectoryIndex in httpd.conf  so that apache can search for
index.php by default when a directory is requested.

DirectoryIndex index.html index.html.var index.php

Restart Apache

#/usr/local/apache2/bin/apachectl restart

If it didn't give you any error, probably you have a php enabled apache2 server. Congratulations...

About Me |Contact Me | ©2006 Genco (Please refer my page if you use any document in this site) (update 03.06.2006)