Skip to content

Apache configuration

Rich2k edited this page Apr 15, 2013 · 1 revision

Ubuntu

aptitude install apache2 php5-ldap

RedHat Enterprise

Redhat Enterprise 5

yum install httpd php

Redhat Enterprise 4

RHE4 comes with PHP4, we strongly recommend using PHP5 (PHP4 will be deprecated 31-12-2007). You will also need to upgrade the samba installations, mod_auth_ntlm_winbind has problems with the packaged version.

Compiling from source is recommended for RHE4.

Compiling from Source

This is a guide to installing Apache2 with PHP5, LDAP, and SSL. It presumes you have basic linux/unix administration skills. You will need to substitute version numbers where ever you see “version” in a syntax. This may look long and painful but it's really just running a series of commands.

If you run into compile problems, google them and RTFM! This is a guide only, it does not come with technical support.

You really should install SSL and only use authentication over encrypted connections. If you generate your own certificate, your newly created Certificate Authority (CA) can be added to the trusted CA's in your domain through Group Policy (users won't receive security warnings about the authenticity of the certificate).

Grab apache, php, and any add-ins (eg. postgres, mysql) For the purposes of this installation, the tarballs have been extracted to /usr/src/apache.

Configure, Compile and Install Apache

./configure --enable-ssl \
--with-ssl=/usr/share/ssl/ \
--enable-cgi \
--enable-so \
--enable-logio \
--prefix=/usr/local/apache2 \
--bindir=/usr/bin \
--sbindir=/usr/sbin \
--sysconfdir=/etc/httpd

make
make install 

Configure, compile, and install PHP

You will obviously need to have any dependencies installed for PHP to be able to use them.

Use the compile switches to add other options, eg. For MySQL add: –with-mysql \ For PostgreSQL add: –with-pgsql \ For other options, please visit http://docs.php.net/en/configure.html

./configure --with-apxs2=/usr/sbin/apxs \
--enable-track-vars \
--with-config-file-path=/etc/httpd \
--with-openssl=/usr \ 
--with-ldap \
--with-zlib \
--enable-debug

make
make install 

Set Apache to start on post

For Redhat based distributions, add the following to /etc/rc.local

/usr/local/apache/bin/apachectl startssl

or Debian and other similar distributions that do not have rc.local, copy /usr/local/apache/bin/apachectl to init.d and update your init scripts accordingly.

If you've opted to use an encrypted private SSL key (which you should), you’ll need to put in a password whenever the server boots.

Configure httpd.conf Change settings where appropriate, servername, admin, home directory, etc. Add the following to the end of /usr/local/apache/httpd.conf.

AddType application/x-httpd-php .php .htm
AddType application/x-httpd-php-source .phps