← Back to team overview

sslug-teknik team mailing list archive

Re: Gentoo, Apache2 og mod_python.

 

On Fri, May 21, 2004 at 12:42:48PM +0200, Ole Hansen wrote:
> > > Jeg sidder og kæmper lidt med Apache2 og mod_python på en Gentoo Linux.
> > > Jeg har tidligere haft konfigureret og installeret mod_python og
> > > Apache1.3 fra source med succes. Nu vil jeg imidlertid afprøve Apache2
> > > og mod_python, men hente det direkte med emerge.
> > Er du opmærksom på at du skal bruge minimum mod_python 3.0 hvis den skal
> > køre med Apache2?
> Ja, jeg kører mod_python-3.0.4-r2
> og apache-2.0.49-r1.
> Min konfiguration er som følger:
> <IfModule mod_python.c>
>     LoadModule python_module    extramodules/mod_python.so
> 
>   <Directory /var/www/localhost/htdocs>
>       AddHandler mod_python .py
>       PythonHandler mod_python.publisher
>       PythonDebug On
>   </Directory>
> </IfModule>
> Nogle gode idéer?

Vi benytter mod_python på mit arbejde og her ser opsætningen sådan her
ud:

gorm root # cat /etc/apache2/conf/modules.d/16_mod_python.conf
<IfDefine PYTHON>
  <IfModule !mod_python.c>
    LoadModule python_module    extramodules/mod_python.so
  </IfModule>
</IfDefine>

<IfModule mod_python.c>
#
# Mod_python is a module that embeds the Python language interpreter
# within the server, allowing Apache handlers to be written in Python.
#

# This will cause files beneath /home/httpd/htdocs with the extension
# .spam
# to be handled by the Python script /home/httpd/htdocs/eggs.py
#
#<Directory /home/httpd/htdocs>
#    <IfModule mod_mime.c>
#    AddHandler python-program .spam
#    </IfModule>
#    PythonHandler eggs
#</Directory>

# This will cause all requests to the /python heirachy of your
# webserver to be handled by the python script /path/to/myhandler.py
#
#<Location /python>
#    SetHandler python-program
#    PythonPath "sys.path + ['/path/to']"
#    PythonHandler myhandler
#</Location>

# This will cause all requests to the /python heirachy of your
# webserver to be handled by mod_python's Publisher handler
#
#<Location /python>
#    SetHandler python-program
#    PythonHandler mod_python.publisher
#</Location>

</IfModule>

gorm root # grep APACHE2_OPTS /etc/conf.d/apache2
APACHE2_OPTS="-D PHP4 -D PYTHON"

Derudover kører vi så med vhosts og enabler mod_python for de specifikke
domæner der skal bruge det i /etc/apache2/conf/vhosts/vhosts.conf. Det ser
nogenlunde sådan her ud:

    <Directory "/path/to/scripts/dir">
        AddHandler python-program .py
        PythonHandler mod_python.publisher
        PythonDebug On
        AllowOverride None
        Options None
        Order allow,deny
        Allow from all
    </Directory>


Mon ikke at det kan hjælpe dig lidt på vej?

-- 
Anders
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS/O d--@ s:+ a-- C++ UL+++$ P++ L+++ E- W+ N(+) o K? w O-- M- V
PS+ PE@ Y+ PGP+ t 5 X R+ tv+ b++ DI+++ D+ G e- h !r y?
------END GEEK CODE BLOCK------
PGPKey: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8BFECB41


Follow ups

References