Apache Web Server

The PopChart Apache Module (mod_pcis) integrates PopChart with Apache by allowing Apache to receive requests for PopCharts instead of PopChart Server.

Note: You can also use the ISAPI redirector for Apache if you are running it on Windows NT/2000/XP, but this is neither documented or recommended.

This section will help you setup the redirector for Apache. It assumes you are running a version of Apache that supports the dynamic loading of add-in modules (Apache 1.3 or above). You should be logged in as root or have administrative privileges to install the module.

To install the pre-compiled mod_pcis binary

1. Locate the version of mod_pcis.so that has been built for your specific platform. The binary files are located in the dev_tools/apache_redirector directory.

If you cannot find a pre-compiled binary for your platform, check the Corda Technologies website (http://www.corda.com) for additional binaries. If you still cannot find a pre-compiled version, you will need to compile it yourself (refer to "To build mod_pcis from the source code").

2. Locate your Apache server configuration file, httpd.conf. You will need to edit this file later on.

The location of this file varies based on your platform and the installation of Apache. It is usually under the /etc./apache or the /etc./httpd/conf directory.

Note: In the folder from which you copied the mod_pcis.so file, you will find an example_httpd.conf file. This file is an example of what a correctly modified httpd.conf file might look like.

3. Copy the mod_pcis.so file to the directory that contains dynamic modules for your Apache web server.

Usually, this will be the libexec folder inside of your server root directory (e.g. /usr/apache/libexec). You can verify this location by looking at LoadModule entries in your httpd.conf file.

4. In your httpd.conf file, find the section containing LoadModule entries. At the bottom of this section, add the following entry:

LoadModule pcis_module libexec/mod_pcis.so

If you copied the mod_pcis.so file to a different location, you will need to change this line accordingly.

5. In your httpd.conf file, find the section containing AddModule entries. At the bottom of this section, add the following entry:

AddModule mod_pcis.c

6. In your httpd.conf file, locate the <Directory> tag section for your web server's DocumentRoot (usually <Directory "/home/httpd/html">). In this section, locate the list of AddHandler entries. At the bottom of this list, add the following entry:

AddHandler pcis .mod

This command instructs the web server to assign the mod_pcis handler to any request it receives ending with a .mod extension. You can assign this extension to any value you choose. In fact, if you already have a handler for the .mod extension, you will have to choose a different extension.
For example, .pcredirector is also perfectly valid. To have the PopChart redirector handle any requests using a .pcredirector extension, use this statement:

AddHandler pcis .pcredirector

7. Create a subfodler called pcis within the ServerRoot path of your Apache installation (e.g. /usr/apache/pcis). Locate the popchart.cfg file from the same folder that contained mod_pcis.so file and copy it to the pcis subfolder.

8. In the popchart.cfg file, specify the name of the machine and port number that PopChart Server is running on.

The popchart.cfg file tells the redirector where PopChart Server is located. It consists of just one line, in the following format:

-port popchart.image.server:port

You should replace popchart.image.server with the name or IP address of the computer on which PopChart Server is running. You should replace port with the port on which PopChart Server is running. For example, if PopChart Server is running on port 8080 on a computer with the IP address 12.0.8.10, the popchart.cfg file should contain the following line:

-port 12.0.8.10:8080

Note that this address must be accessible to the computer running Apache, but does not need to be visible to the client requesting the PopChart.
You may also need to change the permissions on the mod_pcis.so file so that web clients are able to access it. For instructions on how to do this, refer to your Apache documentation.

9. Restart your web server.

You can do this with the apachectl restart command from the bin directory of your web server's root directory (you can also restart with the command make restart from the mod_pcis_src directory).

10. Web clients will now be able to request images from popchart.mod on your web server.

Note: Actually, they can request a PopChart from anything as long as it has a .mod extension (e.g. pc.mod, getimage.mod, etc.). If you chose an extension other than .mod in Step 6, request images from that extension instead (e.g. popchart.pcredirector).

For example, if your web server is running at http://www.mycompany.com, clients will access PopChart Server through the PopChart redirector at http://www.mycompany.com/popchart.mod.
You should modify your PopChart Embedder code or HTTP requests to PopChart Server so that they use the address of the redirector instead of the address of PopChart Server, as described in "Using HTTP Redirection" in Chapter 12.

To build mod_pcis from the source code

To build mod_pcis, you must have the following: a make utility, C compiler, and PERL. Most UNIX compatible systems will already have these.

1. Copy all the files in the dev_tools/apache_redirector/mod_pcis_src folder to a convenient temporary location on your system (e.g. /usr/local/mod_pcis/). The actual location does not matter.

2. Modify the Makefile file so that the APXS and APACHECTL variables reflect the complete path to your web server's bin directory.

For example, if your web server's bin directory is /usr/apache/bin, you would set the two macro as follows:

APXS = /usr/apache/bin/apxs

APACHECTL = /usr/apache/bin/apachectl

Alternatively, you could make sure that this directory is defined in your environment path.

3. Also in Makefile, edit the value of the INC variable to point to the directory to which you copied the mod_pcis source files.

For example, if you copied the files to /usr/local/mod_pcis, you would set the INC variable as follows:

INC = -I/usr/local/mod_pics

Make sure that you save Makefile when you are done modifying it.

4. Run the Makefile by entering the command make install (or gmake install).

The Makefile will make the appropriate apxs call to compile the source and copy the completed module into the Apache install directory. The apxs command in the Makefile also adds the necessary lines to your web server's httpd.conf file to load mod_pcis dynamically when the web server restarts.

Note: Solaris Users: If you installed a binary version of Apache, chances are that Apache's apxs script (written in Perl and located in the bin directory of the Apache server root) will not properly compile mod_pcis. If it does not properly compile, you will have to manually edit the apxs script file and specify the correct name of your installed C compiler. To do this, locate the my $CFG_CC variable in the script file and enter your compiler name, (e.g. gcc). You may also have to tweak with the my $CFG_CFLAGS and my $CFG_CFLAGS_SHLIB variable values to make it work. Also, make sure that the first line in the apxs script points to the correct location for your Perl interpreter. We have included an example apxs file, apxs_example, in the mod_pcis_src directory for your reference.

5. To set up mod_pcis, follow the steps in "To install the pre-compiled mod_pcis binary" above, beginning with step 6.