wiki on a shared hosting environment with no Python installed (my experience)
Disclaimer: The following is not the right way to do it (I am not sure about security and the number of files is not optimized), but it just works for me...
Hosting situation:
- FTP user access
- a cgi-enabled directory
- no Python installed on the (linux) server
- support for user .htaccess files
Local situation:
- a linux box with:
- a working installation of moinmoin
- moinmoin sources
Contents
beginning
You should have at least 2 directories on the server:
cgi-bin - with cgi execution enabled
htdocs
Is better to know the absolute paths, so upload the following bash script as bashtest.cgi inside the cgi-bin directory
echo "Content-type: text/html" echo echo "<html><head /><body>" echo "<br />The absolute path of your cgi-bin directory is: <br />" pwd echo "</body></html>"
Now point your browser to http://www.yoursite.org/cgi-bin/bashtest.cgi.
I got something like /home/something/www.mywikiname.org/cgi-bin/, but we will suppose the absolute paths are simply:
/path/to/cgi-bin
/path/to/htdocs
uploading Python
We need a new directory to hold the python and python-related tree. If you can make a private, not public accessible directory, is better. I can't, so I just made cgi-bin/pytree. We will protect this directory later with a .htaccess file.
From my archlinux box, I uploaded:
/usr/lib/libpython2.5.so.1.0, /usr/lib/libcrypto.so.0.9.8 , /usr/lib/libssl.so.0.9.8 to cgi-bin/pytree/lib/
/usr/lib/python2.5 to cgi-bin/pytree/lib/python2.5 (with subdirectories, including python2.5/site-packages/MoinMoin)
/usr/bin/python2.5 to cgi-bin/pytree/bin/python2.5 (chmoded 750)
i.e. python and some openssl libs.
To save space on the server you can prune the python2.5/site-packages/ directory leaving only MoinMoin/ and _xmlplus/ (PyXML - required for the "Render as docbook" action) directories.
wrapping Python
Upload the following script as cgi-bin/pytree/bin/python
export PYTHONHOME=/path/to/cgi-bin/pytree export PYTHONPATH=/path/to/cgi-bin/pytree/lib/python2.5 export LD_LIBRARY_PATH=/path/to/cgi-bin/pytree/lib:/path/to/cgi-bin/pytree/lib/python2.5 /path/to/cgi-bin/pytree/bin/python2.5 $@
To see if python works upload this script as cgi-bin/pytest.cgi
echo "Content-type: text/html" echo echo "<html><head /><body>" echo "<br />Your python version is: <br />" /path/to/cgi-bin/pytree/bin/python --version echo "</body></html>"
And open http://www.yoursite.org/cgi-bin/pytest.cgi.
wiki, data and underlay
Follow the instructions in HelpOnInstalling/ApacheOnLinuxFtp.
For example:
htdocs/wiki/ containing the usr/share/moin/htdocs/ tree
htdocs/Moin/data/
htdocs/Moin/underlay/
htdocs/Moin/wikiconfig.py
But if you can, put data, underlay and wikiconfig.py somewhere outside the public directories.
configuring and wrapping the MoinMoin CGI
Edit your local copy of moin.cgi:
# Path to MoinMoin package, needed if you installed with --prefix=PREFIX # or if you did not use setup.py. sys.path.insert(0, '/path/to/cgi-bin/pytree/lib/python2.5/site-packages') # Path of the directory where wikiconfig.py is located. # YOU NEED TO CHANGE THIS TO MATCH YOUR SETUP. sys.path.insert(0, '/path/to/htdocs/Moin')
Rename moin.cgi to moin.py and upload it to cgi-bin/pytree/bin/moin.py. Then upload the following script as cgi-bin/moin.cgi
/path/to/cgi-bin/pytree/bin/python /path/to/cgi-bin/pytree/bin/moin.py $@
.htaccess protection
Upload a .htaccess file with this content:
deny from all
inside this directories:
htdocs/Moin
cgi-bin/pytree
nice URLs (and probably better security)
Follow the instructions on RobertSchumann/ApacheOnLinuxFTPRootWiki.