Make your own free website on Tripod.com
BACK

Apache with mod_ssl, PHP, and mod_perl

This page covers configuring Apache 1.3.20 to use mod_perl-1.26, PHP-4.0.6, mod_ssl-2.8.4, and OpenSSL-0.9.6b.  I didn't cover any options in the httpd.conf file because the file is already fairly well documented.  The version of Linux that I am using is SuSE 7.2.  I installed everything below the /var directory because my /usr directory is getting full (the traditional/default place for Apache and other Daemons is in /usr/local).


To run mod_ssl, you will need at least:

Apache............1.3.X

mod_ssl............2.8.x

OpenSSL...........0.9.x

Mod_perl............1.26

MM..................1.1.x

GZip.................1.2.4

Perl..................5.6.0


Optional Packages

PHP..................4.0.x

MySQL...........3.23.X


After you obtain all the sources, save them all in the same directory as some packages will need access to other packages's sources.

    green:~/apach/web # ls *.gz
    apache_1.3.20.tar.gz
    mm-1.1.3.tar.gz
    mod_perl-1.26.tar.gz
    mod_ssl-2.8.4-1.3.20.tar.gz
    mysql-3.23.44.tar.gz
    openssl-0.9.6b.tar.gz
    php-4.0.6.tar.gz


Part I    Install MM Shared Memory Library
  1. Unpack the source and change to the directory
       # gzip -cd mm-1.1.3.tar.gz | tar xvf -
       # cd  mm-1.1.3
    
  2. To install the MM library into /var/local/mm/{bin,lib,include,man}/ perform the following steps in your shell:
       # ./configure --prefix=/var/local/mm
    
  3. Build MM by running:
       # make
    
  4. Test the libraries
       # make test
    
  5. If that works, install the binary with:
       # make install
    
Part II    Install OpenSSL
  1. Unpack the source and change to the directory
       # gzip -cd openssl-0.9.6b.tar.gz | tar xvf -
       # cd openssl-0.9.6b
    
  2. Run the config script to automatically configure your system
       # ./config no-threads --openssldir=/var/local/openssl -fPIC
    
  3. Build OpenSSL by running:
       # make
    
  4. After a successful build, the libraries should be tested. Run the following to test them:
       # make test
    
  5. If everything tests OK, install OpenSSL with:
       # make install
    
Part III    Install mod_ssl, mod_perl, and PHP
  1. If you want PHP to have MySQL support, you will have to install MySQL before you install PHP.
  2. You should have the latest source available for Apache in the same directory as the other sources; it's easier to access it this way.
    *Note that Apache and mod_ssl have the same version (1.3.20)

  3. Unpackage the sources, including Apache:
       # gzip -cd apache_1.3.20.tar.gz | tar xvf -
       # gzip -cd mod_ssl-2.8.4-1.3.20.tar.gz | tar xvf -
       # gzip -cd mod_perl-1.26.tar.gz | tar xvf -
       # gzip -cd php-4.0.6.tar.gz | tar xvf -
    
  4. Apply mod_ssl to Apache source tree
       # cd mod_ssl-2.8.4-1.3.20
       # ./configure --with-apache=../apache_1.3.20
       # cd ..
    
  5. Apply mod_perl to Apache source tree and build/install the PERL-side of mod_perl
       # cd mod_perl-1.26
       # perl Makefile.PL \
              EVERYTHING=1 \
              APACHE_SRC=../apache_1.3.20/src \
              USE_APACI=1 \
              PREP_HTTPD=1 \
              DO_HTTPD=1
       # make
       # make install
       # cd ..
    
  6. Configure PHP and apply it to the Apache source tree
       # cd php-4.0.6
       # CFLAGS='-O2 -I/var/local/openssl/include' \
         ./configure --with-apache=../apache_1.3.20 \
            --enable-track-vars \
            --with-mysql=/usr/local/mysql \
            --enable-memory-limit=yes \
            --enable-debug=no
       # make
       # make install
    
  7. Copy the php.ini-dist file to /var/local/lib/php.ini.
       # cp php.ini-dist /var/local/lib/php.ini
       # cd ..
    
  8. Build/install Apache with mod_ssl, mod_perl, and PHP 4.
       # cd apache_1.3.20
       # SSL_BASE=/var/local/openssl \
         ./configure \
            --enable-module=so \
            --enable-module=proxy \
            --enable-module=info \
            --enable-module=alias \
            --enable-module=dir \
            --enable-module=userdir \
            --prefix=/var/local/httpd \
            --enable-module=ssl \
            --enable-module=so \
            --activate-module=src/modules/php4/libphp4.a \
            --activate-module=src/modules/perl/libperl.a
       # make
    
  9. Next you are asked to make a site certificate, the default type is test.  You will be prompted to answer some question about your certificate, it's fine to accept the defaults if you aren't actually installing a certificate from a CA.
       # make certificate test
    
  10. If the next step goes correctly you will see a messsage of how to start the server.
       # make install
         [output cut]
       +--------------------------------------------------------+
       | You now have successfully built and installed the      |
       | Apache 1.3 HTTP server. To verify that Apache actually |
       | works correctly you now should first check the         |
       | (initially created or preserved) configuration files   |
       |                                                        |
       |   /var/local/httpd/conf/httpd.conf
       |                                                        |
       | and then you should be able to immediately fire up     |
       | Apache the first time by running:                      |
       |                                                        |
       |   /var/local/httpd/bin/apachectl start
       |                                                        |
       | Or when you want to run it with SSL enabled use:       |
       |                                                        |
       |   /var/local/httpd/bin/apachectl startssl
       |                                                        |
       | Thanks for using Apache.       The Apache Group        |
       |                                http://www.apache.org/  |
       +--------------------------------------------------------+
    
  11. You can now delete all the sources or archive them for future servers.
       # cd ..
       # rm *.tar.gz
    
  12. Start your server using the scripts mentioned in step 10 and view the available modules with the following command.
       # /var/local/httpd/bin/httpd -l
       Compiled-in modules:
         http_core.c
         mod_env.c
         mod_log_config.c
         mod_mime.c
         mod_negotiation.c
         mod_status.c
         mod_info.c
         mod_include.c
         mod_autoindex.c
         mod_dir.c
         mod_cgi.c
         mod_asis.c
         mod_imap.c
         mod_actions.c
         mod_userdir.c
         mod_alias.c
         mod_access.c
         mod_auth.c
         mod_proxy.c
         mod_so.c
         mod_setenvif.c
         mod_ssl.c
         mod_php4.c
         mod_perl.c
    
  13. After you have restarted your server you will see this line in the /var/local/httpd/logs/error_log.  It indicates how Apache is configured and is shown after Apache received a signal to restart.  I've shown it here to verify SSL, PERL, and PHP are working on the server.
    [Tue Oct 2 2001] [notice] Apache/1.3.20 (Unix) mod_perl/1.26 PHP/4.0.6 mod_ssl/2.8.4 \
     OpenSSL/0.9.6b configured -- resuming normal operations
    
BACK