Setting Up Apache
These are things I like to do when I set up a new Apache 2 server. For ideas on setting up software RAID, a serial console, SAMBA, and configuring Linux, see my topic guide on setting up a Linux server.
- Decide what user you want to own the Apache installation. Suppose its web. Create user web with the directory /web as its home. Become web for the rest of this. You'll need to use sudo to do some of the installations and start and stop the web server.
- Download Apache, PHP, OpenSSL, cronolog, and any other modules you need. I untar all of these in the same top-level directory, usually /web/srcs.
- Make and install cronolog first.
- Make and install the latest OpenSSL. The one that comes with
your distro is probably out of date and you need the source tree
anyway for mod_ssl. If openssl is already installed on your
machine, take care to overwrite the old version with the new so
that you only have one copy.
./config --prefix=/usr --shared make make install
- Build Apache. I used the following configuration line:
./configure --prefix=/web --enable-module=so --enable-ssl \ --enable-dav --with-ssl=/usr/include/openssl --enable-rewrite make make certificate TYPE=custom make install
- Install mysql and related repositories. I'm using Fedora, so I
use yum. If you're using another distro, you'll need to
figure out how to install packages (try apt-get).
sudo yum install mysql-server sudo yum install mysql sudo yum install mysqlclient sudo yum install mysql-develUse chkconfig to make sure that mysqld starts up. Also, amek sure that libmysqlclient.so can be found by ensuring the directory where its located is in /etc/ld.so.conf and then running /sbin/ldconfig.
- Build the graphics libraries that PHP likes. Many of these may already be installed.
- Build libjpeg and install in /usr/local (http://freshmeat.net/projects/libjpeg/)
./configure make make install make install-lib
cp scripts/makefile.linux ./Makefile make make install make install-headers
./configure make make install
./configure --prefix=/web --with-apxs=/web/bin/apxs \ --with-config-file-path=/web/lib/ --with-zlib \ --with-ttf --with-mysql=/usr \ --with-mysql-sock=/var/run/mysqld/mysqld.sock \ --disable-rpath --disable-ipv6 --enable-static \ --enable-roxen-zts --enable-track-vars \ --enable-force-cgi-redirect --with-gettext \ --with-gd --enable-bcmath make make install
sudo chcon -t texrel_shlib_t /web/modules/libphp4.so
- Set up logging using cronolog
ErrorLog "|/usr/local/sbin/cronolog /web/logs/%Y/%m/%d/errors.log" CustomLog "|/usr/local/sbin/cronolog /web/logs/%Y/%m/%d/access.log" combined
- Ensure PHP is configured right by testing it (the installation should do this automatically).
- Add index.php and any others to the Indexes directive.
- Read the SSL configuration file.
Last Modified: Thursday, 31-Mar-2005 12:32:46 MST