This installation guide is aimed at advanced users who wish to install their own dedicated Apache server instance. We will only cover Apache, but other web server software such as Lighttpd is also supported.

Fetch and extract the sources

Download the Apache distribution from httpd.apache.org (or ftp.csoft.net/distfiles), and unpack it under ~/src:

$ cd ~/src
$ tar -xzf httpd_x.x.xx.tar.gz
$ cd httpd_x.x.xx

Compile and install your Apache instance

Now is time to define the compile-time options to use. To allow future upgrades, make sure to save the ./configure arguments to the file ~/src/httpd-config.sh. Our administrators will look for this file whenever your Apache installation will need to be recompiled (i.e., for security or reliability fixes, or to match upgrades in system libraries).

For the full list of modules and options, see the Apache documentation. Since your Apache instance runs entirely under your account, you don't need to worry about the suexec options. If you have multiple domain names, you probably want to enable the mod_vhost_alias to faciliate the configuration. If you want to use Subversion with mod_dav_svn (as described here), enable the dav module as well. A typical configuration might look like this:

If you need SSL support, add --enable-ssl. For DAV support (required by mod_dav_svn), pass --enable-dav as well.

Now you can compile and install Apache into your home directory:

$ sh ~/src/httpd-config.sh
$ make all install

Basic Apache configuration

Open up the Apache configuration file (./apache/conf/httpd.conf) in your favorite text editor.

First and foremost, you should set the KeepAlive parameter to On and configure KeepAliveTimeout to a sensible value, usually between 1 and 10. This parameter is crucial to performance and controls the number of seconds the connections with web browsers will remain open awaiting future queries. If you are serving pages with few or no images, you can set KeepAlive to Off (this will make your web server less susceptible to denial-of-service attacks).

It is also important to set the MaxClients parameter to a proper value that your server and the resources alloted under your hosting plan can accomodate (please contact us about tuning this parameter).

Assuming you have compiled Apache with the prefork MPM (the default), StartServers, MinSpareServers and MaxSpareServers need to be tweaked as well. Too many processes will not necessarily improve performance and bumping into your account's maximum process limit would cause problems.

Look for the Listen directive and replace it with your v-host IP address (as shown by dns list in csoftadm). Specify 8080 for the port number (packets to port 80 will be redirected accordingly).

Listen w.x.y.z:8080

If you need SSL support, add a second Listen entry with port 8443.

Now specify the location of your webpages with DocumentRoot. The VirtualDocumentRoot directive allows you to configure new domain names under your account (i.e., using the DNS section of the Control Panel or the dns commands in the Shell Interface), without having to edit httpd.conf every time. In this example, the VirtualDocumentRoot directive dictates that any domain domain.ext should simply point to /home/myself/www/domain.ext.

DocumentRoot /home/myself/www
VirtualDocumentRoot /home/myself/www/%0

We now need to allow access to the DocumentRoot:

<Directory "/home/myself/www">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>

The Options string defines the default web server options. Indexes enables directory listings and FollowSymLinks instructs the web server to follow symbolic links. Other commonly used options include MultiViews to turn on the HTTP/1.1 language negotiation feature and ExecCGI for CGI script execution.

The AllowOverride parameter defines the ability of .htaccess files to override certain aspects of the server configuration on a per directory basis. If you prefer, you can avoid editing .htaccess files altogether and edit your httpd.conf instead (in that case, set AllowOverride to None).

Logfile configuration

Before using logs under your custom Apache server, make sure to disable your access and error logs with the shared Apache, otherwise conflicts will disrupt the logging process (see the Server Settings section of the Control Panel, or use conf from the Shell Interface).

The LogFormat directive specifies the format of log entries. Here we use the standard "combined" log format. The CustomLog directive specifies the location of the logfile. The preferred location for logfiles is /logs/username/:

You'll probably want to configure a log analysis tool such that the logfile is analyzed and rotated periodically. See Site statistics with Webalizer for details.

File extension mappings / directory index

The .cgi extension is usually associated with the cgi-script handler.

AddHandler cgi-script .cgi

Optional: SSL support

If need SSL support, you need to specify at least SSLCertificateFile and SSL_CertificateKeyFile, set SSLEngine to On. Our servers use specialized hardware for RC4, MD5 and SHA, so we recommend also setting SSLCipherSuite to the value below.

If you don't have a certificate signed by a recognized authority, you can always use a self-signed certificate as described in the SSL micro-howto.

Optional: PHP support with mod_php

You can fetch the PHP distribution from php.net (or ftp.csoft.net/distfiles) and unpack it in some temporary location:

$ tar -xzf php-x.x.tar.gz
$ cd php-x.x

Now choose the compilation settings. Again, please save the ./configure arguments to ~/src/php-config.sh. To ensure best performance, make sure to explicitely disable all the options which you do not require (these will otherwise be enabled by default if they exist on the system). The --prefix, --with-apxs2 and --disable-cgi options are required. A typical configuration might look like:

If you are migrating from the shared Apache and want to make sure to use the same settings, you can check the phpinfo() for the PHP configuration you were previously using:

$ echo '<?phpinfo()?>' php4-fat > php4-fat.html
$ lynx php4-fat.html

You will probably want to enable GD and JPEG/PNG if some of your scripts are using imaging features. The --with-gd and --with-ttf options require special consideration. If your account is on an OpenBSD server, substitute /usr/local for /usr/X11R6.

If your scripts need the MBSTRING extension, use --enable-mbstring. Do not enable this option unless you really need it.

When you are satisfied with the settings, install PHP and copy the example php.ini to the directory specified in --with-config-file-path. Open up php.ini in an editor and tweak the settings to your liking.

We recommend that you install the eAccelerator extension, to improve the performance of PHP scripts. Fetch eaccelerator-*.tar.bz2 from the eAccelerator website (or ftp.csoft.net/distfiles) and unpack it in a temporary location. Download the file eaccelerator-config.sh from ftp.csoft.net/examples, or copy/paste the following:

If you wish to run FastCGI applications, you will need the mod_fastcgi module loaded into your server. Fetch the latest version from ftp.csoft.net/distfiles and unpack it to some temporary location. In the mod_fastcgi source directory, issue:

Sites with a lot of HTML content will benefit from compression. This is especially true for visitors with slow links. Apache can be configured to automatically compress output for browsers which support it. Add the following to your httpd.conf to enable compression:

You are free to use the Apache modules of your choice. We also provide official technical support for every module mentioned in your hosting plan description.

Launching the web server

You can now start the daemon and test it remotely. If the server is unreachable, consult the ErrorLog file.

$ ~/apache/bin/apachectl start
$ lynx http://domain.ext:8080

If you have enabled SSL:

$ lynx http://domain.ext:8443

It is critical to add a @reboot directive to your crontab so that your server will be started automatically whenever the machines hosting your account are rebooted. Use crontab -e to bring up your crontab in the default text editor and add the line:

@reboot $HOME/apache/bin/apachectl start

You may want to use the standard Apache utilities without having to provide the full ~/apache/bin path:

When you are ready for your Apache server to handle requests for your domains, send us a request via the contact form. We will set up a packet-level "rewriting rule" such that the standard, privileged ports 80 and 443 (for SSL) can be used by your Apache server.

We will also perform the few additional steps needed for redundancy, such that a backup server will automatically start up your server if the master server fails.