<?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="https://wiki.hcoop.net/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><section><title>The quick way</title><para>See <ulink url="https://wiki.hcoop.net/HelpOnInstalling/StandaloneServer/DesktopEdition#">DesktopEdition</ulink>. </para></section><section><title>The flexible way</title><para>Instead of just running it like described above, you can of course move stuff to different places (see <ulink url="https://wiki.hcoop.net/HelpOnInstalling/StandaloneServer/HelpOnInstalling/BasicInstallation#">../BasicInstallation</ulink>, <ulink url="https://wiki.hcoop.net/HelpOnInstalling/StandaloneServer/HelpOnInstalling/WikiInstanceCreation#">../WikiInstanceCreation</ulink>). </para><para>You can then invoke the moin standalone server using the <code>moin</code> scripting command: </para><screen><![CDATA[# for details and other options, see: moin server standalone --help
moin --config-dir=/etc/moin server standalone --docs=/usr/share/moin/htdocs]]></screen><para>Of course you have to give correct values that match your setup: </para><itemizedlist><listitem><para><code>--config-dir</code> gives the directory that contains your wikiconfig (or farmconfig). </para><itemizedlist><listitem><para>wikiconfig points to other important pathes, e.g. <code>data_dir</code> and <code>underlay_dir</code> </para></listitem></itemizedlist></listitem><listitem><para><code>--docs</code> gives the directory where moin finds the static files (css, imgs, etc.) </para></listitem></itemizedlist><para>If it does not find the <code>moin</code> command: </para><itemizedlist><listitem><para>if you used <code>setup.py</code> it should have copied it to <code>/usr(/local)/bin</code> - check your PATH. </para></listitem><listitem><para>if you don't want to use <code>setup.py</code> just write your own <code>moin</code> command script: </para><screen><![CDATA[#Fix and uncomment those 2 lines if it doesn't find the MoinMoin package:
#import sys
#sys.path.insert(0, '/path/to/moin_code')
from MoinMoin.script.moin import run
run()]]></screen></listitem></itemizedlist><para><inlinemediaobject><imageobject><imagedata depth="16" fileref="https://wiki.hcoop.net/moin_static1911/moniker_bt/img/idea.png" width="16"/></imageobject><textobject><phrase>(!)</phrase></textobject></inlinemediaobject> If it crashes and tells it can't import <code>MoinMoin</code>, then just uncomment and fix the <code>sys.path</code> stuff you see above. </para><para>Now point your browser at <code>http://localhost:8080/</code> (or whatever moin tells you). </para><para>If you want to run the moin process as a daemon, have a look at the <code>--start</code>, <code>--stop</code> and <code>--pidfile</code> options. </para><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 start moin 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></section><section><title>Standalone Server configuration</title><para>Alternatively to giving parameters by commandline options, you can also have a <code>wikiserverconfig.py</code> and specify your stuff in a <code>Config</code> class there. See the example file in the toplevel directory. </para><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. </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> 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. </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. </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>}. </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="https://wiki.hcoop.net/HelpOnInstalling/StandaloneServer/SecureThreadPoolServer#">SecureThreadPoolServer</ulink>, this must point to the server's private key. </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="https://wiki.hcoop.net/HelpOnInstalling/StandaloneServer/SecureThreadPoolServer#">SecureThreadPoolServer</ulink>, this must point to the server's certificate. </para></entry></row></tbody></tgroup></informaltable><itemizedlist><listitem override="none"><para><inlinemediaobject><imageobject><imagedata depth="16" fileref="https://wiki.hcoop.net/moin_static1911/moniker_bt/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>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>Using the secure standalone server</title><para>The standalone server supports SSL when using the <ulink url="https://wiki.hcoop.net/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="https://wiki.hcoop.net/HelpOnInstalling/StandaloneServer/SecureThreadPoolServer#">SecureThreadPoolServer</ulink></emphasis>.  </para><para>Two additional configuration options are required when using the <ulink url="https://wiki.hcoop.net/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="16" fileref="https://wiki.hcoop.net/moin_static1911/moniker_bt/img/alert.png" width="16"/></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="16" fileref="https://wiki.hcoop.net/moin_static1911/moniker_bt/img/alert.png" width="16"/></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></article>