Apache Installation for web services

By | March 16, 2016

Documentation for the Apache Install primarily comes from Downloaded httpd-2.0.48.tar.gz from one of the Apache mirror sites at http://www.apache.org.

# tar xvzf httpd-2.0.48.tar.gz

mod_security – Download mod_security-1.7.4.tar.gz from http://www.modsecurity.org/download/.

I am going to install mod_security as a static module in Apache

# tar xvzf mod_security-1.7.4.tar.gz
# cd mod_security-1.7.4/apache2/
# cp mod_security.c ../../httpd-2.0.48/modules/mappers/
# tar xvzf httpd-2.0.48.tar.gz


Create the user that apache will run under 

(You must never have Apache run as ‘root’)

# groupadd -g 48 www
# useradd -c “Apache Web Server” -d /home/httpd -g 48 -s /sbin/nologin -u 48
www
# cd httpd-2.0.48
# vi +66 support/apxs.in


Change
my $installbuilddir = “@exp_installbuilddir@”;
to
my $installbuilddir = “/usr/lib/httpd/build/”;

# vi +119 server/mpm/prefork/prefork.c


Change
#define DEFAULT_SERVER_LIMIT 256
to
#define DEFAULT_SERVER_LIMIT 1024

Configure Apache using your specified configuration


# make
# make install
# strip /usr/sbin/httpd

The strip command removes symbols from object files. This will make our binary files smaller in size.

# chmod 0511 /usr/sbin/httpd
# strip –strip-debug -R .comment /usr/lib/httpd/modules/*.so
# mkdir -p /var/log/httpd
# mkdir -p /var/lib/dav
# rm -rf /var/logs
# mv /home/httpd/build /usr/lib/httpd/build
# rm -f /usr/lib/httpd/build/libtool
# ln -s /usr/bin/libtool /usr/lib/httpd/build/libtool
# ln -s /var/log/httpd /etc/httpd/logs
# ln -s /var/run /etc/httpd/run
# ln -s /usr/lib/httpd/modules /etc/httpd/modules
# ln -s /usr/lib/httpd/build /etc/httpd/build

The following is added to fix problem when building PHP4:

# mkdir /home/httpd/build
# ln -s /usr/bin/libtool /home/httpd/build/libtool

Create the httpd logrotate file;

# vi /etc/logrotate.d/httpd

Add the following:
/var/log/httpd/*_log {
missingok
notifempty
sharedscripts
postrotate
/usr/bin/killall -HUP httpd
endscript
}

# chmod 640 /etc/logrotate.d/httpd
# chown 0.0 /etc/logrotate.d/httpd
# vi /etc/sysconfig/httpd

Add the following:

# Uncomment the following line to enable SSL support with Apache.
# Certificate should be already configured into httpd.conf file.
#
#OPTIONS=”-DSSL”

Create the Apache Initialization script (/etc/init.d/httpd)

# vi /etc/init.d/httpd
# chmod 700 /etc/init.d/httpd
# chown 0.0 /etc/init.d/httpd
# chkconfig –add httpd
# chkconfig –level 345 httpd on

Create the apache configuration file.

# vi /etc/httpd/conf/httpd.conf

Copy the httpd.conf from the openna website and it should work

# vi +26 /etc/httpd/conf/httpd.conf

Change the two Listen lines to the correct IP Address.

For example:

Listen 192.168.0.50:80
Listen 192.168.0.50:443

# vi +204 /etc/httpd/conf/httpd.conf

Change NameVirtualHost to correct IP
Change VirtualHost also to the correct IP

 

One thought on “Apache Installation for web services

  1. Pingback: Set up Apache with TLS/SSL Support | Open Source and Linux

Leave a Reply

Your email address will not be published. Required fields are marked *