Python working on Apache

mod_python is an Apache module that embeds the Python interpreter within the server. With mod_python you can write web-based applications in Python that will run many times faster than traditional CGI and will have access to advanced features such as ability to retain database connections and other data between hits and access to Apache internals.

Adding permission to serve the htdocs directory

In some (sane) Linux distributions (like SuSE 9.0) serving directories other than the
document-root “/srv/www/htdocs” with Apache is switched off by default for
security reasons in “/etc/httpd/httpd.conf” (or for Apache2 “/etc/apache2/httpd.conf”):

# forbid access to the entire filesystem by default
<Directory />
Options None
AllowOverride None
Order deny,allow
Deny from all
</Directory>

To allow Apache to serve directories outside of the document root you have to add these
lines to “/etc/httpd/httpd.conf” (in SuSE it is recommended to create a new “http.conf.local” and
include this file in “/etc/sysconfig/apache2″):

Alias /wiki/ "/usr/share/moin/htdocs/"
<Directory "/usr/share/moin/htdocs/">
Order deny,allow
Allow from all
</Directory>
ScriptAlias /mywiki "/usr/share/moin/mywiki/cgi-bin/moin.cgi"
<Directory "/usr/share/moin/mywiki/cgi-bin">
Order deny,allow
Allow from all
</Directory>

List of .htaccess Examples

From the .htaccess cheatsheet

Advanced mod_rewrite Expert Tricks

Most if not all web developers and server administrators struggle with Apache mod_rewrite. It’s very tough and only gets a little easier with practice. Until Now! Get ready to explode your learning curve,…. The following undocumented techniques and methods will allow you to utilize mod_rewrite at an “expert level” by showing you how to unlock its secrets.

Running CherryPy behind Apache using mod_rewrite

Here are some myths about running CherryPy behind mod_rewrite:

Myth 1: using mod_rewrite will make my site slower
If you’re talking about raw HTTP speed then yes, using mod_rewrite does add a little bit of overhead. On my current laptop, a benchmark of CherryPy exposed gave 460 requests/second (2.2ms/req), and a benchmark of CherryPy running behind Apache [...]

Generate and User your own SSL Key in Apache

Do It Yourself SSL Guide
By Stephen Philbin
There are many people who want or need to have the connection between the browser and the Web server encrypted, but haven’t been able to set it up. This guide is intended to help people with the typical Apache on Linux setup to make encrypted connections available with [...]

DreamHost httpd.conf

    Alias /icons/ "/usr/local/dh/apache/template/icons/"

    <Directory "/usr/local/dh/apache/template/icons">
        Options Indexes MultiViews
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>

    # This Alias will project the on-line documentation tree under /manual/
    # even if you change the DocumentRoot. Comment it if you don't want to
    # provide access to the on-line documentation.
    #
    Alias /manual/ "/usr/local/dh/apache/template/docs/manual/"

    <Directory "/usr/local/dh/apache/template/docs/manual">
        Options Indexes FollowSymlinks MultiViews
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>

    #

Caching Files in .htaccess with Expires

Files and Cache Expiration
For Apache to send along Expires with your staticly served files, you will need to make sure that mod_expires has been installed on your server. It is fairly standard and none of my servers I checked (that includes OS X’s Apache installation), didn’t have mod_expired on the system. You may have [...]

Firefox and Google speed up your site

Prefetching Hints – Helping Firefox and Google speed up your site

The Prefetching Problem
Wouldn’t it be better to download the next page we’ll want to click while we’re reading the one before? That’s the thinking behind prefetching, whether it’s done by the Firefox browser or the Google Web Accelerator. There’s been a lot of controversy [...]

MultiViews approach on an Apache Web server

Setting up language negotiation involves

1. developing a convention for naming the different language versions of your file,
2. planning a fallback strategy to deal with requested languages that you don’t support, and
3. setting the appropriate server-side directives to make it all work.