perl-docs-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject cvs commit: modperl-docs/src/docs/1.0/guide scenario.pod Changes.pod
Date Mon, 22 Dec 2003 02:24:22 GMT
stas        2003/12/21 18:24:22

  Modified:    src/docs/1.0/guide scenario.pod Changes.pod
  Several handy mod_rewrite rules
  Submitted by:	Fred Moyer <>
  Revision  Changes    Path
  1.10      +49 -1     modperl-docs/src/docs/1.0/guide/scenario.pod
  Index: scenario.pod
  RCS file: /home/cvs/modperl-docs/src/docs/1.0/guide/scenario.pod,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -u -r1.9 -r1.10
  --- scenario.pod	31 Jul 2002 14:44:19 -0000	1.9
  +++ scenario.pod	22 Dec 2003 02:24:22 -0000	1.10
  @@ -1653,6 +1653,11 @@
   =head1 mod_rewrite Examples
  +Example code for using mod_rewrite with mod_perl application
  +servers. Several examples were taken from the mailing list.
  +=head2 Rewriting Requests Based on File Extension
   In the mod_proxy + mod_perl servers scenario, C<ProxyPass> was used to
   redirect all requests to the mod_perl server, by matching the
   beginning of the relative URI (e.g. I</perl>). What should you do if
  @@ -1686,16 +1691,20 @@
   It says: log all the rewrites thru the pipe to the C<rotatelogs>
   utility which will rotate the logs every 2 hours (86400 secs).
  -More examples:
  +=head2 Internet Exporer 5 favicon.ico 404
   Redirect all those IE5 requests for I<favicon.ico> to a central image:
     RewriteRule .*favicon.ico /wherever/favicon.ico [PT,NS]
  +=head2 Hiding Extensions for Dynamic Pages
   A quick way to make dynamic pages look static:
     RewriteRule ^/wherever/([a-zA-Z]+).html /perl-bin/$1.cgi [PT]
  +=head2 Serving Static Content Locally and Rewriting Everything Else
   Instead of keeping all your Perl scripts in I</perl> and your static
   content everywhere else, you could keep your static content in special
   directories and keep your Perl scripts everywhere else.  You can still
  @@ -1737,6 +1746,45 @@
     RewriteRule ^/(images|style) - [L]
     RewriteRule ^/(.*)$1 [P]
     ProxyPassReverse /
  +=head2 Upgrading mod_perl Heavy Application Instances
  +When using a light/heavy separation method one of the challenges of
  +running a production environment is being able to upgrade to newer
  +versions of mod_perl or your own application. The following method can
  +be used without having to do a server restart.
  +Add the following rewrite rule to your httpd.conf file:
  +  RewriteEngine On
  +  RewriteMap maps txt:/etc/httpd.maps
  +  RewriteRule ^(.*) http://${maps:appserver}$1 [proxy]
  +Create the file /etc/httpd.maps and add the following entry:
  +  appserver
  +Mod_rewrite rereads (or checks the mtime of) the file on every request
  +so the change takes effect immediately. To seamlessly upgrade your
  +application server to a new version, install a new version on a
  +different port. After checking for a quality installation, edit
  +/etc/httpd.maps to point to the new server. After the file is written
  +the next request the server processes will be redirected to the new
  +=head2 Blocking IP Addresses
  +The following rewrite code blocks IP addresses:
  +  RewriteCond /web/site/var/blocked/REMOTE_ADDR-%{REMOTE_ADDR} -f
  +  RewriteRule .* http://YOUR-HOST-BLOCKED-FOR-EXCESSIVE-CONSUMPTION [redirect,last]
  +To block IP address, simply touch
  +  /web/site/var/blocked/REMOTE_ADDR-
  +This has an advantage over Apache parsing a long file of addresses in
  +that the OS is better at a file lookup.
   =head1 Caching in mod_proxy
  1.39      +7 -0      modperl-docs/src/docs/1.0/guide/Changes.pod
  Index: Changes.pod
  RCS file: /home/cvs/modperl-docs/src/docs/1.0/guide/Changes.pod,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -u -r1.38 -r1.39
  --- Changes.pod	1 Dec 2003 20:23:59 -0000	1.38
  +++ Changes.pod	22 Dec 2003 02:24:22 -0000	1.39
  @@ -11,6 +11,13 @@
   =head1 Ongoing
  +* scenario.pod:
  + o Several handy mod_rewrite rules (summarized by Fred Moyer <fred
  +   \at\>)
  +  - Upgrading mod_perl Heavy Application Instances [Rob Nagler]
  +  - Blocking IP Addresses [Randal L. Schwartz]
   * porting.pod
    o revamp the "Exposing Apache::Registry secrets" section to use

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message