Web Python Tutorial:Apache Configuration

2010-09-25  来源:本站原创  分类:转贴的文章  人气:1 

Taken from http://webpython.codepoint.net/

If you installed mod_python from a Linux package you probably already have this line in your httpd.conf:

LoadModule python_module modules/mod_python.so

Otherwise add it. There are two options to configure the Publisher handler. Those are the SetHandler and the AddHandler directives

SetHandler directive

This will be used in this tutorial. If you want to follow it exactly use it yourself and avoid plenty of confusion. In this configuration all files in a directory will be handled by the Publisher.

<Directory /path/to/publisher/directory>
   SetHandler mod_python
   PythonHandler mod_python.publisher
   PythonDebug On
</Directory>

The lines above must be included in the Apache httpd.conf file or in the .htaccess file. The <Directory> directive must not be used inside the .htacces file. Instead use only the three internal lines.

The first line, SetHandler mod_python, tells Apache that all the files in that directory will be handled by mod_python, regardless of the file extension.

The second line, PythonHandler mod_python.publisher, is a mod_python directive. The mod_python handler to be used here is the Publisher.

The third line, PythonDebug On, sets mod_python to send error messages to the standard output, quite convenient for debugging. Should be deleted when in production.

This configuration will be used in the next pages. It enables a traversal algorithm a bit more convenient than the configuration shown next. That is, it allows the index page of the site to be executed when no page is declared in the URL as in http://mysite.tld. Also there is no need to write the .py extension.

If there is the need to serve static files from the same directory add this:

<Files ~ "\.(gif|html|jpg|png)$">
   SetHandler default-handler
</Files>

AddHandler directive

The second option to configure the Publisher handler is changing the SetHandler directive to:

AddHandler mod_python .py

With this directive all other file types will be handled by their default handlers without the need to set them. But it will be necessary to use the .pyextension in the URIs.

相关文章
  • Web Python Tutorial:Apache Configuration 2010-09-25

    Taken from http://webpython.codepoint.net/ If you installed mod_python from a Linux package you probably already have this line in your httpd.conf: LoadModule python_module modules/mod_python.so Otherwise add it. There are two options to configure th

  • Three Web Server analysis (Apache.Lighttpd.Nginx) 2010-06-11

    Transfer from race question First, the software introduced 1. Lighttpd Lighttpd is a very low memory overhead, CPU occupancy rate is low, performance is good, and a wealth of modules and so on. Lighttpd is a lightweight, OpenSource webserver many of

  • Apache configuration http.conf bound by multiple domain names and two Domain Names 2011-07-29

    Apache configuration http.conf bound by multiple domain names and two Domain Names By Minidxer | April 12, 2008 Apache is the most popular HTTP server software, one of its to fast, reliable (stable) is known, and can be extended through simple API, P

  • tomcat and apache configuration gzip (HTTP compression) function 2010-03-24

    tomcat configuration: <Connector port="80" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount=&

  • CentOS Apache configuration Xiangjie 2010-04-01

    Wants to achieve in the linux web server (www) requires the server software Apache, but Apache can only provide data on only the most basic static website, dynamic web site if you want, better to PHP and MySQL support, so let's will be LAMP (linux +

  • Apache Configuration 2010-05-14

    WWW server under the well-known research firm's survey, 50 percent more than the world's WWW server are using Apache, is the world's number one WEB server. Apache birth very dramatic. When the NCSA WWW server projects to a halt, those using the NCSA

  • php configuration of Apache configuration 2010-06-06

    Learn Java, php development has been dry, a bit small cups. Recently put my project, I found something previously never used finishing off, just recently not much to complain of dry matter, the past and open Everything made the finishing order. php s

  • windows under the Apache configuration SSL secure connection 2010-07-15

    What is SSL? SSL (Secure Socket Layer): to provide security for the Http transport protocol, by the certificate authentication to ensure that the client and site server data is secure. Open SSL Download: http://www.openssl.org/source/ First, download

  • ubuntu, apache configuration file 2010-08-30

    After installing Apache the most important thing is to know the Web document root where, for Ubuntu, the default is / var / www. How do you know it? apache2.conf where there is no DocumentRoot entry, httpd.conf is empty, so sure in other documents. A

  • Detailed apache configuration 2010-11-30

    # Apache configuration Detailed http://lamp.linux.gov.cn/Apache/ApacheMenu/index.html Chinese version of Apache2 httpd.conf configuration file Detailed # # Configuration files based on NCSA services. # # This is the main Apache server configuration f

  • This machine tests using Appserv Apache configuration method of multi-site 2011-01-06

    This machine tests using appserv apache configuration method of multi-site installation of the appserv, we all know in the www folder, add the site to test the file, you can access via 127.0.0.1 or localhost, I found a problem these days, if I have a

  • Detailed Apache configuration file httpd.conf 2011-03-29

    Detailed Apache configuration file httpd.conf # # Apache server is the main configuration file. Including the directory server command settings. # See <URL:http://www.apache.org/docs/> # # Please read to understand the basis of use of the command. #

  • subversion + apache configuration 2011-05-13

    Note: Currently under windows with subversion only with Apache2.0.x can not be used Apache2.2.x, unless you compile your own Subversion server configuration in all ways, based on the Apache is the most flexible. Although the configuration up a little

  • CentOS Apache configuration in detail 2011-03-03

    To achieve the linux web server (www) requires the Apache server software, but Apache can only provide basic data only static websites, dynamic website, then you want to achieve, it is best to PHP and MySQL support, so let's will be LAMP (linux + Apa

  • Reference to this article from the Apache configuration: Development Institute http://edu.codepub.com original link: http://edu.codepub.com/2009 2010-06-13

    1. What is Apache? Apache, an open source HTTP server that can run on most operating systems, because of its multi-platform and security so widely used, is the most popular Web server software. Apache first by the University of Illinois at Urbana-Cha

  • Weblogic + Apache configuration load balancing (Load Balancing) to note that the 2008-10-16

    In the Weblogic + Apache configuration load balancing (using mod_wl_20.so or mod_wl_22.so) when, in the Apache configuration file to configure mod_wl_2x.so parameters, CookieName parameters should be noted, must be configured with the weblogic.xml in

  • apache configuration balance 2010-03-29

    Today, tried a bit to do with apache load balancing, back-office application servers to use jetty to run a very simple war. There are many online cluster apache + tomcat to do the article introduction, Man You help. Application access address: http:/

  • http://psing.org photoshop, javascript, ajax, web design, web develop, tutorial 2010-03-26

    http://psing.org Focus on web design and development front - focus on web design and develop photoshop, javascript, ajax, web design, web develop, tutorial, tutorials, material, web design, closure, front desk

  • apache configuration multi-port multi-domain 2010-06-08

    1, single-domain single-port settings, such as: www.abc.com defaults to 80 visits Specified, apache configuration default installation directory in the conf directory inside or / etc/apache2 But we must note, listen.conf file port monitor is turned o

  • Subversion apache configuration combined with 2010-07-10

    Subversion apache configuration combined with the following steps: 1. vi / usr / local / apache / conf / httpd.conf Found # Virtual hosts # Include conf / extra / httpd-vhosts.conf To # Virtual hosts Include conf / extra / httpd-vhosts.conf 2. vi / u