<?xml version="1.0" encoding="utf-8"?><!DOCTYPE article  PUBLIC '-//OASIS//DTD DocBook XML V4.4//EN'  'http://www.docbook.org/xml/4.4/docbookx.dtd'><article><articleinfo><title>HelpOnInstalling/StandaloneServer</title></articleinfo><para><emphasis role="strong">Installing and configuring standalone server</emphasis> </para><para>See also: <ulink url="http://www.nnx.me/HelpOnInstalling/StandaloneServer/HelpOnConfiguration/IntegratingWithApache#">HelpOnConfiguration/IntegratingWithApache</ulink> </para><para>The standalone server is especially made for local wikis because it does not need a web server installed. Only Python and Moin are necessary! </para><para>To install and run the standalone server: </para><orderedlist numeration="arabic"><listitem><para>If <ulink url="http://www.nnx.me/HelpOnInstalling/StandaloneServer/MoinMoin#">MoinMoin</ulink> is not installed yet, perform <ulink url="http://www.nnx.me/HelpOnInstalling/StandaloneServer/HelpOnInstalling/BasicInstallation#">../BasicInstallation</ulink> </para></listitem><listitem><para>Create a wiki instance as described in <ulink url="http://www.nnx.me/HelpOnInstalling/StandaloneServer/HelpOnInstalling/WikiInstanceCreation#">../WikiInstanceCreation</ulink> </para></listitem><listitem><para>Copy <code>moin.py</code> to your wiki directory, where your <code>wikiconfig.py</code> is </para></listitem><listitem><para>If you installed with <code>--prefix</code> option, you must edit moin.py and set <code>docs</code> to the correct path. </para></listitem><listitem><para>Run <code>moin.py</code> </para></listitem><listitem><para>Access your wiki at <ulink url="http://localhost:8000/"/> </para></listitem></orderedlist><para>On most cases, the default settings will be just fine. You may want to edit <code>moin.py</code> and change some of the options, as described in the next section. </para><section><title>Configuring moin.py</title><section><title>System path configuration</title><para>If you did a standard install, and you are not a developer, you probably want to skip this section. If not, you might want to add the path to moin and config file, like that: </para><screen><![CDATA[import sys
sys.path.insert(0, '/path/to/moin')
sys.path.insert(0, '/path/to/wikiconfig')]]></screen><para><anchor id="options"/> </para></section><section><title>Config class options</title><informaltable><tgroup cols="3"><colspec colname="col_0"/><colspec colname="col_1"/><colspec colname="col_2"/><tbody><row rowsep="1"><entry colsep="1" rowsep="1"><para> <emphasis role="strong">Option</emphasis> </para></entry><entry colsep="1" rowsep="1"><para> <emphasis role="strong">Default</emphasis> </para></entry><entry colsep="1" rowsep="1"><para> <emphasis role="strong">Comment</emphasis> </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para> name </para></entry><entry colsep="1" rowsep="1"><para> <code>'moin'</code> </para></entry><entry colsep="1" rowsep="1"><para> Server name, used by default for log and pid files. <inlinemediaobject><imageobject><imagedata depth="16" fileref="http://www.nnx.me//moin_static197/ninuxtheme02/img/idea.png" width="16"/></imageobject><textobject><phrase>(!)</phrase></textobject></inlinemediaobject> New in 1.5 </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para> docs </para></entry><entry colsep="1" rowsep="1"><para> <code>'/usr/share/moin/wiki/htdocs'</code> </para></entry><entry colsep="1" rowsep="1"><para> Path to moin shared files. If you used <code>--prefix</code> install, the default path will not work, and you must set the path to <code>'PREFIX/share/moin/wiki/htdocs'</code>. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para> user </para></entry><entry colsep="1" rowsep="1"><para> <code>'www-data'</code> </para></entry><entry colsep="1" rowsep="1"><para> If you run as root, the server will run with as this user </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para> group </para></entry><entry colsep="1" rowsep="1"><para> <code>'www-data'</code> </para></entry><entry colsep="1" rowsep="1"><para> If you run as root, the server will run with as this group </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para> port </para></entry><entry colsep="1" rowsep="1"><para> <code>8000</code> </para></entry><entry colsep="1" rowsep="1"><para> Port to serve. To serve privileged port under 1024 you will have to run as root </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para> interface </para></entry><entry colsep="1" rowsep="1"><para> <code>'localhost'</code> </para></entry><entry colsep="1" rowsep="1"><para> The interface the server will listen to. The default will listen only to localhost. Set to <code>''</code> to listen to all.</para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para> logPath </para></entry><entry colsep="1" rowsep="1"><para> <code>name + '.log'</code> </para></entry><entry colsep="1" rowsep="1"><para> Log file. Default is commented. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para> serverClass </para></entry><entry colsep="1" rowsep="1"><para> <code>'ThreadPoolServer'</code>, <code>'ThreadingServer'</code>, <code>'ForkingServer'</code>, <code>'SimpleServer'</code>, <code>'SecureThreadPoolServer'</code> </para></entry><entry colsep="1" rowsep="1"><para> The server type to use, see the comments in the <code>moin.py</code>. The default is <code>'ThreadPoolServer'</code>, which create a pool of threads and reuse them for new connections. <inlinemediaobject><imageobject><imagedata depth="16" fileref="http://www.nnx.me//moin_static197/ninuxtheme02/img/idea.png" width="16"/></imageobject><textobject><phrase>(!)</phrase></textobject></inlinemediaobject> New in 1.3.5 </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para> threadLimit </para></entry><entry colsep="1" rowsep="1"><para> <code>10</code> </para></entry><entry colsep="1" rowsep="1"><para> How many threads to create. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para> requestQueueSize </para></entry><entry colsep="1" rowsep="1"><para> <code>50</code> </para></entry><entry colsep="1" rowsep="1"><para> The count of socket connection requests that are buffered by the operating system. <inlinemediaobject><imageobject><imagedata depth="16" fileref="http://www.nnx.me//moin_static197/ninuxtheme02/img/idea.png" width="16"/></imageobject><textobject><phrase>(!)</phrase></textobject></inlinemediaobject> New in 1.3.5 </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para> properties </para></entry><entry colsep="1" rowsep="1"><para> <code> {} </code> </para></entry><entry colsep="1" rowsep="1"><para> allow overriding any request property by setting the value in this dict e.g <code>properties = {'script_name': '/mywiki'</code>}. <inlinemediaobject><imageobject><imagedata depth="16" fileref="http://www.nnx.me//moin_static197/ninuxtheme02/img/idea.png" width="16"/></imageobject><textobject><phrase>(!)</phrase></textobject></inlinemediaobject> New in 1.5 </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para> ssl_privkey </para></entry><entry colsep="1" rowsep="1"><para> <code> None </code> </para></entry><entry colsep="1" rowsep="1"><para> If using the <ulink url="http://www.nnx.me/HelpOnInstalling/StandaloneServer/SecureThreadPoolServer#">SecureThreadPoolServer</ulink>, this must point to the server's private key <inlinemediaobject><imageobject><imagedata depth="16" fileref="http://www.nnx.me//moin_static197/ninuxtheme02/img/idea.png" width="16"/></imageobject><textobject><phrase>(!)</phrase></textobject></inlinemediaobject> New in 1.6 </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para> ssl_certificate </para></entry><entry colsep="1" rowsep="1"><para> <code> None </code> </para></entry><entry colsep="1" rowsep="1"><para> If using the <ulink url="http://www.nnx.me/HelpOnInstalling/StandaloneServer/SecureThreadPoolServer#">SecureThreadPoolServer</ulink>, this must point to the server's certificate <inlinemediaobject><imageobject><imagedata depth="16" fileref="http://www.nnx.me//moin_static197/ninuxtheme02/img/idea.png" width="16"/></imageobject><textobject><phrase>(!)</phrase></textobject></inlinemediaobject> New in 1.6 </para></entry></row></tbody></tgroup></informaltable><itemizedlist><listitem override="none"><para><inlinemediaobject><imageobject><imagedata depth="16" fileref="http://www.nnx.me//moin_static197/ninuxtheme02/img/idea.png" width="16"/></imageobject><textobject><phrase>(!)</phrase></textobject></inlinemediaobject> There may be more options useful to moin developers, see the comments in <code>moin.py</code> </para></listitem></itemizedlist></section><section><title>Using the secure standalone server</title><para><inlinemediaobject><imageobject><imagedata depth="16" fileref="http://www.nnx.me//moin_static197/ninuxtheme02/img/idea.png" width="16"/></imageobject><textobject><phrase>(!)</phrase></textobject></inlinemediaobject> New in 1.6 </para><para>The standalone server supports SSL when using the <ulink url="http://www.nnx.me/HelpOnInstalling/StandaloneServer/SecureThreadPoolServer#">SecureThreadPoolServer</ulink> server class. The SSL support is provided by the <ulink url="http://trevp.net/tlslite/">TLSLite library</ulink>. <emphasis role="strong">All wiki traffic is forced to SSL when using the <ulink url="http://www.nnx.me/HelpOnInstalling/StandaloneServer/SecureThreadPoolServer#">SecureThreadPoolServer</ulink></emphasis>.  </para><para>Two additional configuration options are required when using the <ulink url="http://www.nnx.me/HelpOnInstalling/StandaloneServer/SecureThreadPoolServer#">SecureThreadPoolServer</ulink>. First, <code>ssl_privkey</code> must point to the server's private key. Second, <code>ssl_certificate</code> must point to the server's certificate.  </para><para><inlinemediaobject><imageobject><imagedata depth="15" fileref="http://www.nnx.me//moin_static197/ninuxtheme02/img/alert.png" width="15"/></imageobject><textobject><phrase>/!\</phrase></textobject></inlinemediaobject> <emphasis>TLSLite does not support a password protected private key unless additional libraries are used. Consult the TLSLite webpage for more information.</emphasis> </para><para>Typically a certificate would be purchased from an certificate authority, such as Thawte (<ulink url="http://www.thawte.com"/>). However, since the suggested usage of the standalone server is for personal use, a self signed certificate may be appropriate. For more information on how to generate a server private key, and a self signed certificate, see the <ulink url="http://www.openssl.org/docs/HOWTO/">openssl HOWTO pages</ulink>. </para><para>For example, to create the server's private key, run the following: </para><para><code>openssl genrsa -out privkey.pem 2048</code> </para><para>To create a self signed certificate for the newly created private key, run the following: </para><para><code>openssl req -new -x509 -key privkey.pem -out cacert.pem -days 1095</code> </para><para>moin.py then needs to be told about the generated files <code>privkey.pem</code> and <code>cacert.pem</code>. For the example above, the following lines would need to be added to moin.py: </para><screen><![CDATA[    ssl_privkey = "/secure/path/to/privkey.pem"
    ssl_certificate = "/secure/path/to/cacert.pem"]]></screen><para><inlinemediaobject><imageobject><imagedata depth="15" fileref="http://www.nnx.me//moin_static197/ninuxtheme02/img/alert.png" width="15"/></imageobject><textobject><phrase>/!\</phrase></textobject></inlinemediaobject> Using a self signed certificate will cause your browser to generate a warning that it cannot verify the identify of the wiki server. This is because the certificate was not signed by a recognized certificate authority (CA). In order to get rid of this warning, you must purchase a certificate from a CA. </para></section></section><section><title>Configuring wikiconfig.py</title><para>The sample config file should be just fine. </para><para>The default value of <code>url_prefix_static</code> is hardcoded into the standalone server script, do not change it or it won't work! </para></section><section><title>Starting the server</title><para>Run <code>moin.py</code> from the command line: </para><screen><![CDATA[$ ./moin.py
Serving on localhost:8000]]></screen><para>Test your wiki at <ulink url="http://localhost:8000/"/> </para><para>On Windows, you can double click <code>moin.py</code> to start the server. A new terminal window will be opened. Close the window or press <code>Control + Pause</code> to stop the server. </para><para>On Unix, interrupt the server with <code>Control + C</code> in order to shut it down. </para></section><section><title>Serving port 80 on Unix</title><para>On GNU/Linux, Mac OS X or other Posix like OS, you can serve the standard port 80 used for web serving, but you must run as <code>root</code> for this. </para><para>Set <code>port</code> to 80, and verify that <code>user</code> and <code>group</code> exists on your system. If not, set them to an existing user, meant for web serving. If needed, <code>chown</code> your wiki dir to this user and group. </para><para>Run <code>moin.py</code> as root: </para><screen><![CDATA[$ sudo moin.py
Password:
Serving on localhost:8000
Running as uid/gid 70/70]]></screen><para>Test your wiki at <ulink url="http://localhost/"/> </para></section><section><title>Running as daemon</title><para>If run on Unix, you can run moin.py as a background process: </para><orderedlist numeration="arabic"><listitem><para>Have a working <code>moin.py</code> as explained above </para></listitem><listitem><para>Copy the file <code>prefix/share/moin/server/moin</code> to your wiki directory. </para></listitem><listitem><para>Start moin server: </para></listitem></orderedlist><screen><![CDATA[./moin start]]></screen><para>To stop the server: </para><screen><![CDATA[./moin stop]]></screen><para>For more info run <code>moin</code> with no arguments. </para><para>If you want to start moin from a system startup script, you may need to add the path to <code>moin.py</code> in the top of the script: </para><screen><![CDATA[# Add the path to moin.py directory 
import sys
sys.path.insert(0, '/path/to/moin')]]></screen><itemizedlist><listitem override="none"><para><inlinemediaobject><imageobject><imagedata depth="16" fileref="http://www.nnx.me//moin_static197/ninuxtheme02/img/idea.png" width="16"/></imageobject><textobject><phrase>(!)</phrase></textobject></inlinemediaobject> New in release 1.5 </para></listitem></itemizedlist></section></article>