TABLE OF CONTENTS

1. Read this first

/!\ This documentation is for the version 1.2 of MoinMoin!

The docs are in HelpOnInstalling/ApacheWithFastCgi and HelpOnInstalling/ApacheWithModPython, cause it could be used on any operating system on which mod_python and FastCGI run. This is at least Unix and Windows, and perhaps MacOS X. Basic installation and OS specific installation is the same as for a CGI, you just need the apache module and a different thing than the ScriptAlias directive to configure it.

2. mod_python execution process in a nut

Clarification of the mod_python run process:

  1. apache sees the .htaccess
  2. if the URI matchs the Files section, it is 'executed'
  3. SetHandler tells apache to use mod_python for everything in the 'File'

  4. PythonPath extends sys.path

  5. PythonHandler tells mod_python what to do to handle requests. this is a module to import!

  6. mod_python tries to import moin_modpy(.py) (so this must be in sys.path!)

  7. moin_modpy.py imports some MoinMoin stuff (so moin_modpy needs a sys.path in which the MoinMoin package can be found)

  8. mod_python calls the method handler of moin_modpy

2.1. Questions & Answers

  1. "Hello. I'm just following your Instructions on this Site. But i'm unable to show my Server (works fine with cgi-version of MoinMoin), from which place he should take the Instance of the new wiki (driven by mod-python-Handler). I couldn't understand, how the Handler works..."

    • At least someone who tries, thanks. What did you do? What version of moin, apache, and mod_python do you use?

      • Using base SuSE 9.0 with:
        • Apache 1.3.28
        • mod_python 2.7.8
        • Python 2.3+
        • MoinMoin 1.2 von 20040124

          • you should consider using mod_python 3.1.2b with apache 2.0.48 in combination with python 2.3.X. We had some problems with py 2.3 and mod_python versions below 3.1... but I don't think that this is your problem.

        • Moved .htaccess-File to Root-Dir of ...
          • Document-root of the apache-webserver AND
          • "Root" of the wiki-instance, mostly named as "mywiki"
            • no, only one htaccess, please!

          • I think, the "howto" is unclear, where i had to put the .htaccess. I mean, it must be the "root" of the wiki-instance.
            • no, the .htaccess must be in the path below which you instance should be, you don't need a path for it, cause it's only virtual.

        • Use the wrapper-script: moin_modpy.py, using the correct path

    • mod_python is correctly enabled and works (tested with Spyce :) )

    • Many greetings from Hannover... And please excuse my rotten-english ;)

      • I'm german. greetings from Koblenz.... perhaps you could come into the irc for a more direct discussion? channel #moin on FreeNode server irc.freenode.net

        • Thanx, maybe, that i would answer today evening... IRC is not allowed from my workplace and from my home-net too because of SECURITY. Do you have ICQ? Or should we use Mail?
          • yes, I have ICQ, mail me to <ograf AT rz DASH online DOT net>

    • Some questions to you (these are the questions the doc ask you):
      • where should your wiki could be found (URL and corresponding physical path)?
      • where is the MoinMoin python package installed?

        • Does this question mean:

          • /usr/lib/python/site-packages/!MoinMoin (this is the Path under SuSE 9.0)

            • this means: you don't need to specify the path for this in moin_modpy.py wrapper.
      • where is the moin_modpy.py wrapper?
        • /usr/share/moin/TEST/

          • this path must be added in the PythonPath entry in the htaccess

      • where is moin_config.py?
        • /usr/share/moin/TEST/

          • already added in the last step.
      • Path of the Apache-Document-Root:

        • /srv/www/htdocs/

        • Place of the .htaccess-file
          • correct. here should be the .htaccess. it should have an entry <Files TEST> so that you can access your wiki below TEST.

    • What has happened since this Dialog?

      • Why am i interested in "getting for flying faster versions of MoinMoin"?

        • I try to build a great inhouse-intraweb-wikiweb-community for my company...
      • What did i do, to get MoinMoin running in faster Versions?

        • Switched to Apache 2.0.48, newer mod_python version (shipped with SuSE 9.0 is 3.0.x)
        • Tried newest mod_python version 3.1.2b (can't compile this whith SuSE 9.0, i am an Apache-Newbie ;) )

        • Started to get FastCGI running
          • Works after 2 working nights!! ;)

          • MoinMoin is very fast, didn't make a benchmark, only the feeling is very very fast!!!

      • Thank you, JH and OG and TW and all others for your work, i would try to develop with MoinMoin in this year...

      • My own Wiki (at home, behind t-dsl) is here: http://www.pronobis.net/KH/ (almost the old version whith "slow" Apache 1.3.x and normal CGI-Based MoinMoin, would update this next days :) )

        • Question: Do you have any corrections for the install docs above? Did you stumble over some errors? Or are there places where the docs are misleading? -- OliverGraf 2004-02-01 08:13:00

        • I already added to the docs in moinmaster: In SUSE 9.0 (and I suppose in some other distributions too) reading of .htaccess is swiched of by default in http.conf with
          * forbid access to the entire filesystem by default
          <Directory />
            Options None
            AllowOverride None
            Qrder deny, allow
            Deny from all
          </Directory>
          to allow reading .htaccess you have to add to http.conf (In suse it is in http.conf actually recommended to create a new http.conf.local and include it in /etc/sysconfig/apache2).
          <Directory "/src/www/htdocs"
             # this is the document root in Suse
          
             AllowOverride All 
             # AllowOverride Options FileInfo might be work too
          </Directory>

          --added by KonradBauckmeier 25.03.2004

If you are using somewhat like data_dir = './data', consider using an absolute path.

  1. I'm so confused at this point as to what files need to be where and what needs to be edited. Perhaps most of all is the httpd.conf file. Using CGI I just used  ScriptAlias /mywiki "D:/Moin/mywiki/moin.cgi" . Seeing as I'm now trying to use mod_python to run it, I'm not supposed to use this file anymore. Ok, fine, but what do I tell Apache to run instead? Everything I've been able to come up with hasn't worked. Any help would be much appreciated.

    • Did you read the docs? They where moved to HelpOnInstalling/ApacheWithModPython for the 1.2 release.

      • Yes, several times actually, trying to figure out if I was missing something. How does Apache know how to deal with the wiki under mod_python? That's the part I'm missing. Like I said, previously I used ScriptAlias, but if I still use that (and not use the cgi file), what do I put in its place?

        • hmmm... the docs tell you to use .htaccess... can you come into the MoinMoinChat?

          • Can't get into the chat while at work, which is where the wiki is. .htaccess, as I understand it is a directory specific configuration file for Apache. If I say  ScriptAlias /mywiki "D:/Moin/mywiki/.htaccess"  I get an error "Forbidden". Is there an example somewhere of a working mod_python httpd.conf file? Or at least the last few lines of it is all I need I suppose.

            • please show me the place in the docs that tell you to define an ScriptAlias. you don't need config in your httpd.conf. just the .htaccess file. The <Files> statement lists the name of your wiki. See the comments in those files.

              • In the basic MoinMoin installation is the ScriptAlias (for the cgi install). The mod_python version says to follow the basic installation, but don't copy the moin.cgi file as it isn't needed for mod_python. So, without ScriptAlias, what do I put where (I assume httpd.conf) to tell Apache how to deal with a request to http://myserver/mywiki ? I've tried  Alias /mywiki 'D:/Moin/mywiki/.htaccess' . If you like, I can post some files and you can tell me what I have wrong. It's just that, IMO, the CGI installation is quite clear, with examples, as to what files to edit, what to add, etc. The mod_python installation just refers to some files and implies what needs to be added, no examples (except the fix to mod_python so as to run it without the wrapper).

              • Thought I'd add some file excerpts:
                • httpd.conf (since Apache needs to know how to deal with the inital request):

Alias       /wiki/     "D:/apps/python23/share/moin/htdocs/"
Alias       /wikidata/ "d:/Moin2/wikidata"
Alias       /pdwiki     "d:/Moin2/pdwiki/"

<Files pdwiki>

  # Use mod_python as handler
  SetHandler mod_python

  # set the path to the MoinMoin package and to the moin_config.py
  PythonPath "['D:\\apps\\Python23\\Lib\\site-packages\\MoinMoin','D:\\moin2\\pdwiki']+sys.path"

  # choose the ModPy Request class as handler
  PythonHandler MoinMoin.request::RequestModPy.run

</Files> 

[Fri Jul  9 16:43:11 2004] [error] [client 192.168.1.66] FastCGI: comm with server "/usr/local/share/moin/espresso-wiki/moin.fcg" aborted: protocol error: invalid version: 34 != FCGI_VERSION(1)

The number (34) varies from time to time. I've googled for the problem a bit and I understood the problem might be related with MoinMoin spewing output on stdout or stderr when it's not supposed to. Turning off fast cgi solves the problem, but slows down the wiki too much. :( Any idea?

Here is my detailed config:

LoadModule fastcgi_module     libexec/apache/mod_fastcgi.so
#...
AddModule mod_fastcgi.c
#...

    AddHandler fastcgi-script fcgi fcgi fpl fcg

    Alias /moinmoin/ "/usr/local/share/moin/htdocs/"
    Alias /moin/ "/usr/local/share/moin/espresso-wiki/moin.fcg/"

    <Location "/moin/">
        Options +ExecCGI
        Order allow,deny
        Allow from all
    </Location>

Running moinmoin 1.2.2 + apache-mod_ssl 1.3.27+2.8.14 and mod_fastcgi 2.4.2.

Where would be a good place to mention that mod_python is not available for Python24, and that fastcgi for Python doesn't work under Windows?

I'm having constant problems doing searches in the wiki setup with FastCGI. I see this:

[Thu Aug 25 17:49:07 2005] [warn] FastCGI: (dynamic) server "/usr/local/www/wiki/koumbitwiki/moin.fcg" restarted (pid 31342)
Traceback (most recent call last):
  File "/usr/local/www/wiki/koumbitwiki/moin.fcg", line 36, in ?
    fcg.run()
  File "/usr/local/lib/python2.4/site-packages/MoinMoin/support/thfcgi.py", line 577, in run
    (conn, addr) = self.sock.accept()
socket.error: (35, 'Resource temporarily unavailable')
[Thu Aug 25 17:49:07 2005] [error] [client 68.142.251.99] FastCGI: incomplete headers (0 bytes) received from server "/usr/local/www/wiki/koumbitwiki/moin.fcg"
[Thu Aug 25 17:49:07 2005] [warn] FastCGI: (dynamic) server "/usr/local/www/wiki/koumbitwiki/moin.fcg" (pid 31342) terminated by calling exit with status '1'

Here is my fcgi setup:

<VirtualHost *:80>

ServerName wiki.koumbit.net
Alias /_static/ "/usr/local/share/moin/htdocs/"

<Directory "/usr/local/share/moin/htdocs/>
   Order deny,allow
   Allow from all
</Directory>

RewriteEngine On
RewriteLogLevel 0
## static files are somewhere else? ok...
RewriteRule ^/_static(.*)$ /usr/local/share/moin/htdocs/$1 [last]
## map everything else to moin.cgi/moin.fcg
<IfModule !mod_fastcgi.c>
RewriteRule ^(.*)$ /usr/local/www/wiki/koumbitwiki/moin.cgi$1 [type=application/x-httpd-cgi]
</IfModule>
<IfModule mod_fastcgi.c>
RewriteRule ^(.*)$ /usr/local/www/wiki/koumbitwiki/moin.fcg$1 [type=application/x-httpd-fcgi]
</IfModule>

<Directory "/usr/local/www/wiki/koumbitwiki">
        allow from all
        AllowOverride None
        Options ExecCGI FollowSymLinks
        order allow,deny
        SetHandler fastcgi-script
</Directory>

</VirtualHost>

I'm at a loss... I'm very tempted to switch to a twisted setup, but I don't want to run another webserver on the machine... -- TheAnarcat 2005-08-25 17:55:03

MoinMoin: OliverGraf/FastCgiModPyDocs (last edited 2007-10-29 19:08:04 by localhost)