APACHE INSTALLATION GUIDE
=========================
1. Conversion in this installation guide
$APACHE-HOME=/infowarelab/apache2 // directory of apache installed
$SRCDIR=/infowarelab/src // directory of source tarballs holded
the # smybolfollowed by commands stands for the shell prompt
2. Software and Version Requried
openssl-0.9.7g.tar.gz
apr-1.2.7.tar.gz
apr-util-1.2.7.tar.gz
httpd-2.2.3.tar.gz
NOTE:
Obtains source tarballs of softwares
#cd /infowarelab/src
#wget -c
#wget -c
#wget -c
#wget -c
3. Update openssl to 0.9.7g
#cd /infowarelab/scr
#gzip -d openssl-0.9.7g.tar.gz -c | tar xfv -
#cd openssl-0.9.7g
# ./config --openssldir=/usr/local/openssl \
shared \
zlib \
threads
#make && make install
NOTE:
To let apache use the openssl-0.9.7g, remove the openssl development
package shiped with distribution of linux.
#rpm -qa | grep "openssl-devel" | grep "0\.9\.7g" || rpm -e --nodeps openssl-devel
For x86_64 platform, excecute the followsing commands
#ln -s /usr/local/openssl/lib/libssl.so.0.9.7 /lib64
#ln -s /usr/local/openssl/lib/libcrypto.so.0.9.7 /lib64
For x86 platform, excecute the following commands
#ln -s /usr/local/openssl/lib/libssl.so.0.9.7 /lib
#ln -s /usr/local/openssl/lib/libcrypto.so.0.9.7 /lib
4. Install apache apr and apr-util runtime library
#cd /infowarelab/src
#tar zxfv apr-1.2.7.tar.gz && cd apr-1.2.7
#./configure --prefix=/usr/local/apr \
--enable-threads
#make && make install
#cd ..
#tar zxfv apr-util-1.2.7.tar.gz && cd apr-util-1.2.7
#./configure --prefix=/usr/local/apr-util \
--with-apr=/usr/local/apr
#make && make install
5. Install apache
#cd /infowarelab/src
#tar zxfv httpd-2.2.3.tar.gz && cd httpd-2.2.3
#./configure \
--prefix=/infowarelab/apache2 \
--enable-so \
--enable-rewrite \
--enable-vhost-alias=shared \
--enable-cache=shared \
--enable-file-cache=shared \
--enable-disk-cache=shared \
--enable-mem-cache=shared \
--enable-proxy=shared \
--enable-proxy-http=shared \
--enable-proxy-ajp=shared \
--enable-proxy-balancer=shared \
--enable-proxy-connect=shared \
--disable-proxy-ftp \
--disable-userdir \
--disable-asis \
--enable-ssl \
--with-ssl=/usr/local/openssl \
--with-mpm=worker \
--with-apr=/usr/local/apr \
--with-apr-util=/usr/local/apr-util
#make && make install
6. Add permissions management to apache
1) add a user belonged to web group named web who start|stop|restart apache service
#groupadd -g 501 web
#useradd -u 501 -g web -m /infowarelab/platform/web -s /bin/bash web
#passwd web
Changing password for user web.
New UNIX password:******
Retype new UNIX password:******
passwd: all authentication tokens updated successfully.
2) use binary httpd start|stop|restart apache,instead of apachectl shell script
#chmod 600 /infowarelab/apache2/bin/apachectl
#chmod 4755 /infowarelab/apache2/bin/httpd
3) let httpd process run with identified by nobody,instead of daemon
modify httpd.conf with vi or other editor you like.
before modified:
User daemon
Group daemon
after modified:
User nobody
Group nobody
alternative:
#sed -i -e '/^User\ daemon$/s/daemon/nobody/' \
/infowarelab/apache2/conf/httpd.conf
#sed -i -e '/^Group\ daemon$/s/daemon/nobody/' \
/infowarelab/apache2/conf/httpd.conf
4) we have no cgi script and forbit this function in httpd.conf
before modified:
ScriptAlias /cgi-bin/ "/infowarelab/apache2/cgi-bin"
AllowOverride None
Options None
Order allow,deny
Allow from all
after modified:
#ScriptAlias /cgi-bin/ "/infowarelab/apache2/cgi-bin"
#
# AllowOverride None
# Options None
# Order allow,deny
# Allow from all
#
alternative:
#sed -i -e '/ScriptAlias \/cgi-bin\//s/ScriptAlias/#&/' \
/infowarelab/apache2/conf/httpd.conf
#sed -n '/ /infowarelab/apache2/conf/httpd.conf
273
#sed -i -e '273,+5s/^/#/g' /infowarelab/apache2/conf/httpd.conf
5) enable ssi function
before modified:
#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml
after modified:
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
alternative:
#sed -i -e '/\.shtml$/s/#Add/Add/g' \
/infowarelab/apache2/conf/httpd.conf
7. Verify and start apache service
verify apache config file using the below command
#/infowarelab/apache2/bin/httpd -t
Syntax OK
if you see this, then config file is correct!
now switch to web user and start apache service
#su - web
$/infowarelab/apache2/httpd -k start
alternative:
#su - web -c "/infowarelab/apache2/bin/httpd -k start"
launch your browser or wget or curl or HEAD come from perl etc tools and enter
the web server ipaddress plus port:
now you could see a welcome page of apache server
/*
* END
*/
阅读(1054) | 评论(1) | 转发(0) |