Getting Started with mod_perl in 30 Minutes Page 4
Download the authoritative guide: Data Center Guide: Optimizing Your Data Center Strategy
Download the authoritative guide: Cloud Computing: Using the Cloud for Competitive AdvantageConfigure Apache as you always do. Set
ErrorLogand other directives in the
httpd.conffile (remember I've asked you to remember the location of this file at the end of the previous section?). Use the defaults as suggested, customize only when you have to. Values that you need to customize are
DocumentRootand a few others. You will find helpful hints preceding each directive. Follow them if in doubt.
When you have edited the configuration file, it's time to start the server.
One of the ways to start and stop the server is to use the
apachectl utility. You start the server with:
% /usr/local/apache/bin/apachectl start
And stop it with:
% /usr/local/apache/bin/apachectl stop
Note that you have to be root when starting the server if the server is going to listen on port 80 or another privileged port (<1024).
After you start the server, check in the
/usr/local/apache/logs/error_logis the file's default location) that the server has indeed started. Don't rely on the status
apachectlreports. You should see something like the following:[Thu Jun 22 17:14:07 2000] [notice] Apache/1.3.12 (Unix) mod_perl/1.24 configured -- resuming normal operations
Now point your browser to
http://your.server.name/as configured with the
ServerNamedirective. If you have set a
Portdirective with a value different from
80, apply this port number at the end of the server name. If you have used port 8080, test the server with
http://your.server.name:8080/. You should see the infamous "It worked" page, which is an
make installin the Apache source tree installs for you. If you don't see this page, something went wrong and you should check the contents of the
error_logfile. You will find the path of the error log file by looking it up in the
If everything works as expected, shut the server down, open
httpd.confin your favorite editor, and scroll to the end of the file where we will add the mod_perl configuration directives (of course you can place them anywhere in the file).
Assuming that you put all scripts that should be executed by the mod_perl enabled server in the
/home/httpd/perl/directory, add the following configuration directives:Alias /perl/ /home/httpd/perl/ PerlModule Apache::Registry <Location /perl>
SetHandler perl-script PerlHandler Apache::Registry Options ExecCGI PerlSendHeader On allow from all </Location>
Save the modified file.
This configuration causes every URI starting with
/perlto be handled by the Apache mod_perl module. It will use the handler from the Perl module
Now create a
/home/httpd/perl/directory if it doesn't yet exist. In order for you and Apache to be able to read, write and execute files we have to set correct permissions. You could get away by simply doing:% chmod 0777 /home/httpd/perl
IT Solutions Builder TOP IT RESOURCES TO MOVE YOUR BUSINESS FORWARD
Which topic are you interested in?
What is your company size?
What is your job title?
What is your job function?
Searching our resource database to find your matches...