Main Stories
Slash Boxes

Slash Open Source Project

Slashcode Log In

Log In

[ Create a new account ]

Article Poll

Poll I found this article to be
Very Helpful
Helpful
Not Helpful
Not Very Helpful
[ Results | Polls ]
Comments:0 | Votes:0

Two Level Apache/mod_perl Configuration

posted by Krow on 07:23 AM November 7th, 2001   Printer-friendly   Email story
Walke writes "I've been working on setting up a two level Apache configuration for Salmon, Broads & Beer, in anticipation of our usage going through the roof ;-).

After reading the mod_perl guide, I decided to try and use mod_proxy. However, all of the strategies seem to rely on being able to split up the static and dynamic traffic into different areas of the directory structure. The slashcode file layout doesn't seem to lend itself to big gains here. Will serving the "/images" folder from a static httpd really help performance? Or, are the gains all in the caching which mod_proxy provides?

Anyone have experience with any or all of the strategies in the guide? Is mod_proxy the right solution? How should static and dynamic traffic be separated?

Thanks, Vann"

This discussion has been archived. No new comments can be posted.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login
Loading... please wait.
  • mod_proxy is best used coupled with mod_rewrite (Redirect on steroids).
    Here's the relevant lines from my own configuration:
    we have "light" server at http://slash-italian.kenobi.it port 80
    and mod_perl on port 8870

    RewriteEngine on
    RewriteRule   ^/$  http://slash-italian.kenobi.it:8870/  [P,L]
    RewriteRule   ^/(.+\.pl.*)$  http://slash-italian.kenobi.it:8870/$1  [P,L]
    RewriteRule   ^/(~.+)$  http://slash-italian.kenobi.it:8870/$1  [P,L]
    ProxyPassR
    --

    Check out the Slash in Italian Project [kenobi.it]

    • Ahh, I see now. You can base your rewrite rules on reqular expression, not just directories. This helps greatly. Thanks, Vann.
      --
      Salmon, Broads & Beer [salmonbroadsandbeer.com] Northwest journal for t
    • So do you have any data that shows how much of a speed improvement this setup has given to your site(s)?

      Just curious...
      --
      lottadot [lottadot.com]
    • by Anonymous Coward
      Can you explain what these rules are doing exactly?
      • > Can you explain what these rules are doing exactly?

        RewriteEngine on
        activates mod_rewrite

        RewriteRule ^/$ http://slash-italian.kenobi.it:8870/ [P,L]
        send homepage (http://slash-italian.kenobi.it/) to backend server homepage.
        P=Process (I think), L=Last, i.e. we're done.

        RewriteRule ^/(.+\.pl.*)$ http://slash-italian.kenobi.it:8870/$1 [P,L]
        sends all URLs matching .pl to backend: this should cover all perl scripts, including the ones with params on the URL.

        RewriteRule ^/(~.+)$ http://slash-italian.kenobi.it:8870/$1 [P,L]
        this covers all user pages, new in Slash 2.2.

        ProxyPassReverse / http://slash-italian.kenobi.it:8870/
        this hides the mod_perl server, rewriting all internal URLs to base port.

        Hope it helps.

        --

        Check out the Slash in Italian Project [kenobi.it]

  • How ironic... I post a message about improving my server's performance, which gets indirectly slashdotted, causing a server crash.

    The moral is???

    --
    Salmon, Broads & Beer [salmonbroadsandbeer.com] Northwest journal for t
  • I tried setting up something like this last week. I was doing it first with PHP before I attempted it with mod_perl. It worked fine UNTIL I enabled mod_gzip in the front end server. AFter that, URLs like test.php would be passed through fine, but if you add a query string (like test.php?ABC=DEF), the front end server would give a 404 and not pass the request on. Any idea what's up with that?

    And the previous poster is right -- you use mod_rewrite's RewriteRule instead of ProxyPass. That lets you keep the same DocumentRoot for both frontend and backend httpds. The frontend handles graphics, html, and txt files and it passes the rest to the backend.
    --

    Yoder Internet Development [yoderdev.com]: Honest and Affordable Web Solutions
  • squid works good to accelerate web servers.

    squid can be configured in "accelerator" mode. Squid do not fork, it uses threads. It can cache a defined amount of documents. You can define what pages are allowed to be cached by regexps.

    here my squid conf to do this :
    (with name virtual hosting)
    -------------
    http_port my_ip:80

    cache_effective_user nobody
    cache_effective_group nobody

    acl domains dst domain1.com domain2.com
    acl all src 0.0.0.0/0.0.0.0
    http_access allow all
    http_access deny !domains
    httpd_accel_host localhost
    httpd_accel_port 8080
    httpd_accel_with_proxy off
    httpd_accel_uses_host_header on
    ------------
    as you can note apache is running on port 8080 of the same machine. the better would be to run on another machine on port 80.