Tuesday, February 21, 2012

Apache Install

Download Apache

cd /usr/local/src/

tar -jxf /where_apache_tarfile_is/httpd-2.2.15.tar.bz2

cd /usr/local/src/http-x.x.x

Now, configure Apache:

(This assumes that we're installing Apache in /home/httpd. You can install it anywhere you wish by replacing /home/httpd with your location of choice.)

./configure --prefix=/home/httpd --enable-modules=so

maybe change to ./configure --prefix=/var/www/httpd --enable-modules=so

(NOTE: I've included the module so, which makes it easier to add stuff like PHP.)

make ; make install


you can edit the config-layout and add

#   Layout for Slackware Linux      prefix:        /usr     exec_prefix:   ${prefix}     bindir:        ${prefix}/bin     sbindir:       ${prefix}/sbin     libdir:        ${prefix}/lib     libexecdir:    ${prefix}/lib/libexec     mandir:        ${prefix}/man     sysconfdir:    /etc/httpd     datadir:       /var/www     installbuilddir: ${datadir}/build     errordir:      ${datadir}/error     iconsdir:      ${datadir}/icons     htdocsdir:     ${datadir}/htdocs     manualdir:     ${datadir}/manual     cgidir:        ${datadir}/cgi-bin     includedir:    ${exec_prefix}/include/httpd     localstatedir: /var     runtimedir:    ${localstatedir}/run     logfiledir:    ${localstatedir}/log/httpd     proxycachedir: ${localstatedir}/cache/httpd
and run ./configure --enable-layout=Slackware --enable-module=most --enable-mods-shared=most --enable-ssl=shared

If so, we only have a few steps left! If not, you'll need to start reading the error messages and the Apache documentation to figure out what went wrong.

If you'd like Apache to use something other than (or in addition to) index.html as an index page, Just edit the file /home/httpd/conf/httpd.conf and find the section labeledDirectoryIndex and add to the line that looks like:

DirectoryIndex index.html

You can add as many as you like, but I must mention that each one is an additional lookup each time a directory is accessed without a file name. Too many may slow your server down. Anyway, my line looks something like:

DirectoryIndex index.html index.php index.shtml index.htm default.htm

You may need to create rc.httpd in /etc/rc.d:
(This location is for Slackware; you may need a different location for other Linux distributions.)

It should look something like:

#!/bin/sh
if [ "$1" = "stop" ]; then
/home/httpd/bin/apachectl stop
elif [ "$1" = "restart" ]; then
/home/httpd/bin/apachectl restart
elif [ "$1" = "start" ]; then
/home/httpd/bin/apachectl start
else
echo "usage: $0 start|stop|restart";
fi

Then change it so that it can be executed:

chmod a+x rc.httpd

A reboot of your system should have you on your way. If you don't wanna restart, just type:

/etc/rc.d/rc.httpd start

If you can see the page: http://your_server/ then your installation was successful!




No comments: