Apache

From CLONWiki
Jump to navigation Jump to search

Apache initial installation

Login as 'root'. Do following:

download 'httpd-2.2.3.tar.gz' from web to '/usr/local/download/'
cp /usr/local/downloads/httpd-2.2.3.tar.gz /usr/local/src
cd /usr/local/src
gunzip httpd-2.2.3.tar.gz
tar xvf httpd-2.2.3.tar
rm httpd-2.2.3.tar

If in 'clonweb' do fillowing (on 'clonwiki' replace 'clonweb' by 'clonwiki'). Make sure directory '/www/apache2.2.3' exist, create it if necessary.

mv httpd-2.2.3 httpd-2.2.3_clonweb
cd /usr/local/src/httpd-2.2.3_clonweb
./configure --enable-module=so --prefix=/www/apache2.2.3
make
make install

Make sure that user set to 'apache' (should exist already):

grep "^User" /www/apache2.2.3/conf/httpd.conf
emacs /www/apache2.2.3/conf/httpd.conf
set User (and Group) to 'apache' if necessary

PHP Installation

Login as 'root'. Do following:

download 'php-5.2.0.tar.gz' from web to '/usr/local/download/'
cp /usr/local/downloads/php-5.2.0.tar.gz /usr/local/src
cd /usr/local/src
gunzip php-5.2.0.tar.gz
tar xvf php-5.2.0.tar
rm php-5.2.0.tar

Following is for 'clonweb', use your machine name if necessary:

mv php-5.2.0 php-5.2.0_clonweb
cd /usr/local/src/php-5.2.0_clonweb
./configure --with-mysql --with-apxs2=/www/apache2.2.3/bin/apxs
make
##make install
cp /usr/local/src/php-5.2.0_clonweb/libs/libphp5.so /www/apache2.2.3/modules

Fix apache config file /www/apache2.2.3/conf/httpd.conf:

 DirectoryIndex index.php index.html
 LoadModule php5_module modules/libphp5.so
 AddType application/x-httpd-php .php
 AddType application/x-httpd-php .php3
 AddType application/x-httpd-php .phtml

Final Apache Installation

Edit /www/apache2.2.3/htdocs/index.html file.

To start/stop apache server do following:

 /www/apache2.2.3/bin/apachectl start
 /www/apache2.2.3/bin/apachectl stop

If it started fine, fix startup script '/etc/rc.d/init.d/httpd' setting correct pathes:

 # config: /www/apache2.2.3/conf/httpd.conf
 # pidfile: /www/apache2.2.3/logs/httpd.pid
 apachectl=/www/apache2.2.3/bin/apachectl
 httpd=${HTTPD-/www/apache2.2.3/bin/httpd}
 pidfile=${PIDFILE-/www/apache2.2.3/logs/httpd.pid}

Modified file is saved as /www/apache2.2.3/httpd.for_etc_init_d, copy it as /etc/init.d/httpd.

Now apache can be controled by following commands:

 /etc/init.d/httpd stop
 /etc/init.d/httpd start
 /etc/init.d/httpd restart

Add apache to the list of services to be started at boot time using:

 /usr/bin/system-config-services