<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Journal « Raphael Kallensee &#187; apache</title>
	<atom:link href="http://raphael.kallensee.name/journal/tag/apache/feed/" rel="self" type="application/rss+xml" />
	<link>http://raphael.kallensee.name/journal</link>
	<description>Web, Mobile, Design, Music.</description>
	<lastBuildDate>Sun, 08 Jan 2012 18:00:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<atom:link rel="hub" href="http://rkallensee.superfeedr.com/" />
	<atom:link rel="hub" href="http://pubsubhubbub.appspot.com/" />
			<item>
		<title>Installation von Etherpad Lite auf Ubuntu 10.04 Server und Apache als Reverse-Proxy + Upstart</title>
		<link>http://raphael.kallensee.name/journal/etherpad-lite-auf-ubuntu-server-apache-upstart/</link>
		<comments>http://raphael.kallensee.name/journal/etherpad-lite-auf-ubuntu-server-apache-upstart/#comments</comments>
		<pubDate>Sun, 18 Sep 2011 19:48:30 +0000</pubDate>
		<dc:creator>Raphael Kallensee</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[WebDevelopment]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[FLOSS]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Node.js]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://raphael.kallensee.name/journal/?p=347</guid>
		<description><![CDATA[Etherpad Lite ist eine Neuentwicklung des kollaborativen Real-Time-Texteditors Etherpad in Node.js. Ausprobiert werden kann Etherpad Lite beispielsweise unter beta.etherpad.org. Die ursprüngliche Etherpad-Software ist enorm ressourcenhungrig und die Codebase sehr umfangreich &#8211; insbesondere die hohen Anforderungen an den Arbeitsspeicher (im laufenden Betrieb wohl ca. 1 GB!) hielten mich von der Installation auf meinem Server ab. Etherpad [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://raphael.kallensee.name/journal/wp-content/uploads/2011/09/etherpad-lite.png"><img src="http://raphael.kallensee.name/journal/wp-content/uploads/2011/09/etherpad-lite-300x138.png" alt="Screenshot von Etherpad Lite, einem kollaborativen Texteditor" title="Etherpad Lite" width="300" height="138" class="alignleft size-medium wp-image-358" /></a><a href="http://etherpad.org/">Etherpad Lite</a> ist eine <a href="http://etherpad.org/2011/08/22/major-release-etherpad-lite-v1/">Neuentwicklung</a> des kollaborativen Real-Time-Texteditors Etherpad in <a href="http://nodejs.org/">Node.js</a>. Ausprobiert werden kann Etherpad Lite beispielsweise unter <a href="http://beta.etherpad.org/">beta.etherpad.org</a>.</p>
<p>Die ursprüngliche Etherpad-Software ist enorm ressourcenhungrig und die Codebase sehr umfangreich &#8211; insbesondere die hohen Anforderungen an den Arbeitsspeicher (im laufenden Betrieb wohl ca. 1 GB!) hielten mich von der Installation auf meinem Server ab. Etherpad Lite hingegen begnügt sich nach eigenen Angaben im laufenden Betrieb mit <a href="https://github.com/Pita/etherpad-lite#readme">rund 30 MB Arbeitsspeicher</a>.</p>
<p>Diese Anleitung beschreibt die Installation von Node.js, NPM und Etherpad Lite auf Ubuntu 10.04 Server. Da in den meisten Fällen auf Port 80 eines bestehenden Servers bereits ein Webserver (in meinem Fall Apache) läuft, wird Etherpad Lite hinter Apache als Reverse-Proxy (via mod_proxy) installiert. Sicherlich nicht die beste Lösung, eine &#8220;<a href="http://nodejs.org/jsconf.pdf">non-blocking</a>&#8221; Node.js-Applikation hinter einem &#8220;blocking&#8221; Apache-Server zu installieren &#8211; <a href="http://de.wikipedia.org/wiki/Nginx">Nginx</a> wäre hier sicherlich eine bessere Wahl. Aber vorerst soll Apache als Reverse-Proxy genügen. Des weiteren richten wir eine Upstart-Konfiguration ein, die Etherpad Lite nach jedem Reboot automatisch startet.</p>
<h3>Installation von Node.js</h3>
<p>Zunächst installieren wir Node.js auf dem Server. Die Version in den Ubuntu-Paketquellen ist deutlich zu alt, deshalb müssen wir selbst kompilieren. Da wir Node.js, den Node-Paketmanager NPM und die Applikation aus Sicherheitsgründen unter einem eigenen User installieren möchten, legen wir diesen zunächst an:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">groupadd nodejs
useradd <span style="color: #660033;">-g</span> nodejs <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">bash</span> <span style="color: #660033;">-d</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>nodejs nodejs
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>nodejs
<span style="color: #c20cb9; font-weight: bold;">chown</span> nodejs:nodejs <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>nodejs</pre></div></div>

<p>Nun wurde der User nodejs angelegt, sein Home-Verzeichnis ist /var/lib/nodejs. Nun bereiten wir den User für die Installation von Node.js und NPM vor &#8211; wir wechseln in den User nodejs:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">su</span> nodejs
<span style="color: #7a0874; font-weight: bold;">cd</span> ~</pre></div></div>

<p>Der folgende Inhalt muss in die Datei /var/lib/nodejs/.npmrc:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">root =    <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>nodejs<span style="color: #000000; font-weight: bold;">/</span>.node_modules
binroot = <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>nodejs<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin
manroot = <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>nodejs<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">man</span></pre></div></div>

<p>Die entsprechenden Ordner müssen nun noch angelegt werden:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> ~<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">local</span>
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> ~<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> ~<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>share
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> ~<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">man</span></pre></div></div>

<p>Nun fügen wir den Ordner ~/local/bin noch zum PATH hinzu &#8211; die folgende Zeile muss zum einen in die Datei /var/lib/nodejs/.bashrc, zum anderen einmal in der Shell eingegeben werden:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PATH</span>=<span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin:<span style="color: #007800;">$PATH</span></pre></div></div>

<p>Jetzt installieren wir die notwendigen Abhängigkeiten über apt / aptitude:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> build-essential python libssl-dev git-core libsqlite3-dev <span style="color: #c20cb9; font-weight: bold;">gzip</span> curl</pre></div></div>

<p>Nun kann Node.js heruntergeladen und kompiliert werden. Dazu &#8220;klonen&#8221; wir das Git-Repository und checken die letzte stabile Version aus &#8211; was spätere Updates erleichtert.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> ~<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>src
<span style="color: #7a0874; font-weight: bold;">cd</span> ~<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>src
<span style="color: #c20cb9; font-weight: bold;">git</span> clone <span style="color: #c20cb9; font-weight: bold;">git</span>:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>joyent<span style="color: #000000; font-weight: bold;">/</span>node.git
<span style="color: #7a0874; font-weight: bold;">cd</span> node
<span style="color: #c20cb9; font-weight: bold;">git</span> checkout v0.4.12
.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--prefix</span>=<span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">make</span>
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<h3>Installation von NPM</h3>
<p>Jetzt ist Node.js installiert &#8211; wir benötigen aber noch den Node.js-Paketmanager NPM. Den installieren wir ebenfalls aus den GIT-Quellen:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> ~<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>src
<span style="color: #c20cb9; font-weight: bold;">git</span> clone https:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>isaacs<span style="color: #000000; font-weight: bold;">/</span>npm.git
<span style="color: #7a0874; font-weight: bold;">cd</span> npm
<span style="color: #c20cb9; font-weight: bold;">git</span> checkout v1.0.30
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p>Zu guter letzt legen wir noch einen Symlink an, damit NPM später das Verzeichnis für die Node-Module findet, das wir weiter oben bereits konfiguriert haben:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> ~<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>node_modules ~<span style="color: #000000; font-weight: bold;">/</span>.node_modules</pre></div></div>

<h3>Installation von Etherpad Lite</h3>
<p>Nun sind endlich die Voraussetzungen gegeben, um Etherpad Lite zu installieren. Dies tun wir ebenfalls aus den GIT-Quellen. Danach rufen wir ein Shell-Script auf, um die Abhängigkeiten zu installieren.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> ~<span style="color: #000000; font-weight: bold;">/</span>node-apps
<span style="color: #7a0874; font-weight: bold;">cd</span> ~<span style="color: #000000; font-weight: bold;">/</span>node-apps
<span style="color: #c20cb9; font-weight: bold;">git</span> clone <span style="color: #c20cb9; font-weight: bold;">git</span>:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>Pita<span style="color: #000000; font-weight: bold;">/</span>etherpad-lite.git
<span style="color: #7a0874; font-weight: bold;">cd</span> etherpad-lite
.<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>installDeps.sh</pre></div></div>

<p>Jetzt kann die Konfiguration angepasst werden, die sich in der Datei <code>/var/lib/nodejs/node-apps/etherpad-lite/settings.json</code> befindet. Da ich das Etherpad mit MySQL als Datenbank betreiben möchte, kommentiere ich die vorhandene SQLite-Konfiguration aus und füge den MySQL-Benutzer und den Datenbank-Namen hinzu, die ich beide vorher angelegt habe. Den &#8220;loglevel&#8221; setze ich außerdem auf &#8220;WARN&#8221;, um nicht zu viele unnötige Log-Meldungen zu schreiben.</p>
<p>Jetzt legen wir gleich eine Upstart-Konfiguration an, um sicherzustellen, dass das Etherpad nach jedem System-Neustart automatisch gestartet wird. Für eine regelmäßige Überwachung und ggf. Neustart des Etherpads im Fehlerfalle bietet sich <a href="http://mmonit.com/monit/">Monit</a> an &#8211; was aber nicht Teil dieses Artikels sein soll.</p>
<p>Wir legen nun die Datei <code>/etc/init/etherpad-lite.conf</code> mit folgendem Inhalt an (auf Grundlage <a href="https://github.com/Pita/etherpad-lite/wiki/How-to-deploy-Etherpad-Lite-as-a-service">dieser Quelle</a>):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">description <span style="color: #ff0000;">&quot;etherpad-lite&quot;</span>
&nbsp;
start on started networking
stop on runlevel <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000; font-weight: bold;">!</span><span style="color: #000000;">2345</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">env</span> <span style="color: #007800;">NODEBIN</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>nodejs<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>node
<span style="color: #c20cb9; font-weight: bold;">env</span> <span style="color: #007800;">EPHOME</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>nodejs<span style="color: #000000; font-weight: bold;">/</span>node-apps<span style="color: #000000; font-weight: bold;">/</span>etherpad-lite
<span style="color: #c20cb9; font-weight: bold;">env</span> <span style="color: #007800;">EPLOGS</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>etherpad-lite
<span style="color: #c20cb9; font-weight: bold;">env</span> <span style="color: #007800;">EPUSER</span>=nodejs
&nbsp;
pre-start script
    chdir <span style="color: #007800;">$EPHOME</span>
    <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #007800;">$EPLOGS</span>                              <span style="color: #000000; font-weight: bold;">||</span><span style="color: #c20cb9; font-weight: bold;">true</span>
    <span style="color: #c20cb9; font-weight: bold;">chown</span> <span style="color: #007800;">$EPUSER</span>:admin <span style="color: #007800;">$EPLOGS</span>                <span style="color: #000000; font-weight: bold;">||</span><span style="color: #c20cb9; font-weight: bold;">true</span>
    <span style="color: #c20cb9; font-weight: bold;">chmod</span> 0755 <span style="color: #007800;">$EPLOGS</span>                         <span style="color: #000000; font-weight: bold;">||</span><span style="color: #c20cb9; font-weight: bold;">true</span>
    <span style="color: #c20cb9; font-weight: bold;">chown</span> <span style="color: #660033;">-R</span> <span style="color: #007800;">$EPUSER</span>:admin <span style="color: #007800;">$EPHOME</span><span style="color: #000000; font-weight: bold;">/</span>var         <span style="color: #000000; font-weight: bold;">||</span><span style="color: #c20cb9; font-weight: bold;">true</span>
<span style="color: #666666; font-style: italic;">#    exec su -s /bin/bash -c 'exec &quot;$0&quot; &quot;$@&quot;' $EPUSER $EPHOME/bin/installDeps.sh &gt;&gt; $EPLOGS/error.log || { stop; exit 1; }</span>
end script
&nbsp;
script
  <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #007800;">$EPHOME</span><span style="color: #000000; font-weight: bold;">/</span>node
  <span style="color: #7a0874; font-weight: bold;">exec</span> <span style="color: #c20cb9; font-weight: bold;">su</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">bash</span> <span style="color: #660033;">-c</span> <span style="color: #ff0000;">'exec &quot;$0&quot; &quot;$@&quot;'</span> <span style="color: #007800;">$EPUSER</span> <span style="color: #007800;">$NODEBIN</span> server.js \
                        <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$EPLOGS</span><span style="color: #000000; font-weight: bold;">/</span>access.log \
                        <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$EPLOGS</span><span style="color: #000000; font-weight: bold;">/</span>error.log
end script</pre></div></div>

<p><em>(Diese Upstart-Konfiguration ist noch nicht optimal &#8211; spontan gelang es mir nicht, das Shell-Script <code>installDeps.sh</code> im pre-start erfolgreich auszuführen. Deshalb muss man daran denken, dieses Script nach einem Etherpad-Update manuell auszuführen.)</em></p>
<p>Jetzt kann Etherpad ganz einfach mittels</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">start etherpad-lite</pre></div></div>

<p>gestartet werden.</p>
<h3>Einrichtung des Apache Reverse-Proxys</h3>
<p>Nun richten wir Apache ein, damit Etherpad auf Port 80 erreichbar ist. Dafür verwenden wir z.B. die Subdomain etherpad.example.lit &#8211; und folgende virtuelle Host-Konfiguration (beispielsweise in der Datei /etc/apache2/sites-available/etherpad.example.lit):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;</span>virtualhost <span style="color: #000000; font-weight: bold;">*</span>:<span style="color: #000000;">80</span><span style="color: #000000; font-weight: bold;">&gt;</span>
        ServerName etherpad.example.lit
&nbsp;
        ServerAdmin webmaster<span style="color: #000000; font-weight: bold;">@</span>localhost
&nbsp;
        <span style="color: #000000; font-weight: bold;">&lt;</span>ifmodule mod_proxy.c<span style="color: #000000; font-weight: bold;">&gt;</span>
            ProxyVia On
            ProxyRequests Off
            ProxyPass <span style="color: #000000; font-weight: bold;">/</span> http:<span style="color: #000000; font-weight: bold;">//</span>localhost:<span style="color: #000000;">9001</span><span style="color: #000000; font-weight: bold;">/</span>
            ProxyPassReverse <span style="color: #000000; font-weight: bold;">/</span> http:<span style="color: #000000; font-weight: bold;">//</span>localhost:<span style="color: #000000;">9001</span><span style="color: #000000; font-weight: bold;">/</span>
            ProxyPreserveHost on
            <span style="color: #000000; font-weight: bold;">&lt;</span>proxy <span style="color: #000000; font-weight: bold;">*&gt;</span>
                Options FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
            <span style="color: #000000; font-weight: bold;">&lt;/</span>proxy<span style="color: #000000; font-weight: bold;">&gt;</span>
        <span style="color: #000000; font-weight: bold;">&lt;/</span>ifmodule<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
        ErrorLog <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>etherpad-lite<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>error.log
&nbsp;
        <span style="color: #666666; font-style: italic;"># Possible values include: debug, info, notice, warn, error, crit,</span>
        <span style="color: #666666; font-style: italic;"># alert, emerg.</span>
        LogLevel warn
&nbsp;
        CustomLog <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>etherpad-lite<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>access.log combined
        ServerSignature Off
<span style="color: #000000; font-weight: bold;">&lt;/</span>virtualhost<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

<p>Wichtig: das Verzeichnis <code>/var/log/etherpad-lite/apache2/</code> für die Apache-Logs muss angelegt werden!</p>
<p>Daraufhin kann der oben angelegte virtuelle Apache-Host aktiviert werden. Außerdem müssen die Apache-Module mod_proxy und mod_proxy_http aktiviert sein, danach kann die Apache-Konfiguration neu geladen werden:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">a2ensite etherpad.example.lit
a2enmod proxy proxy_http
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>apache2 reload</pre></div></div>

<p>Nun sollte das Etherpad unter http://etherpad.example.lit erreichbar sein!</p>
<h3>Konfiguration von Logrotate</h3>
<p>Wir haben nun einige Log-Dateien unterhalb von <code>/var/log/etherpad-lite/</code>, die schnell sehr groß werden können. Deshalb konfigurieren wir Logrotate so, dass diese Dateien wöchentlich rotiert und gepackt und für acht Wochen vorgehalten werden. Dazu fügen wir einfach folgende Zeilen zur <code>/etc/logrotate.conf</code> hinzu &#8211; oder legen eine <code>/etc/logrotate.d/etherpadlite</code> mit dem folgenden Inhalt an:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># rotate etherpad lite logs</span>
<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>etherpad-lite<span style="color: #000000; font-weight: bold;">/*</span>.log <span style="color: #7a0874; font-weight: bold;">&#123;</span>
        weekly
        missingok
        rotate <span style="color: #000000;">8</span>
        compress
        notifempty
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>etherpad-lite<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/*</span>.log <span style="color: #7a0874; font-weight: bold;">&#123;</span>
        weekly
        missingok
        rotate <span style="color: #000000;">8</span>
        compress
        notifempty
<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<h3>Installation von Abiword für Import/Export (optional)</h3>
<p>Für den erweiterten Import/Export muss die Textverarbeitungs-Software <a href="http://www.abisource.com/">Abiword</a> installiert werden &#8211; deren Binaries benutzt Etherpad zum Lesen und Schreiben von Dokumenten. In Ubuntu 10.04 ist Abiword in den Paketquellen vorhanden, deshalb reicht ein:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> abiword</pre></div></div>

<p>Daraufhin muss in der <code>/var/lib/nodejs/node-apps/etherpad-lite/settings.json</code> der Pfad zum Abiword-Binary angepasst werden:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">/* This is the path to the Abiword executable. Setting it to null, disables abiword.
     Abiword is needed to enable the import/export of pads*/</span>
  <span style="color: #3366CC;">&quot;abiword&quot;</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;/usr/bin/abiword&quot;</span><span style="color: #339933;">,</span></pre></div></div>

<p>Nach einem Neustart mittels</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">stop etherpad-lite
start etherpad-lite</pre></div></div>

<p>stehen die erweiterten Import-/Export-Funktionen zur Verfügung &#8211; dann kann ein Pad beispielsweise auch als PDF exportiert werden.</p>
<h3>Abschluss</h3>
<p>Etherpad Lite ist meiner Meinung nach ein sehr nützliches Tool, um gemeinsam Dokumente zu bearbeiten, Protokolle und To-Do-Listen zu erstellen usw. &#8211; was durch die Export-Funktion in viele Formate sehr gut ergänzt wird. Es existieren auch bereits viele Bibliotheken und Plugins, welche die HTTP-API von Etherpad nutzen, um Etherpads in eigenen Applikationen bequem einzubinden &#8211; Libraries für <a href="https://github.com/jhollinger/ruby-etherpad-lite">Ruby</a>, <a href="https://github.com/tomnomnom/etherpad-lite-client">PHP</a>, ein <a href="https://github.com/johnyma22/etherpad-lite-jquery-plugin">jQuery-Plugin</a>, ein <a href="http://drupal.org/sandbox/webflo/1255474">Drupal-Modul</a> (im Entwicklungsstadium) und viele mehr.</p>
<p>Ein Hinweis zum Schluss: diese Anleitung stellt sicher kein Optimum dar &#8211; jedoch war es mir wichtig, Node.JS sowie NPM nicht als <code>root</code>-User zu installieren. Deshalb weicht diese Anleitung zum Teil von den meisten im Netz zu findenden Anleitungen ab. Verbesserungsvorschläge nehme ich gern per Kommentar oder E-Mail entgegen!</p>
<p>Quellen und weiterführende Links:</p>
<ul>
<li><a href="http://mrtopf.de/blog/de/ein-besseres-etherpad-dank-etherpad-lite/">Ein besseres Etherpad dank Etherpad Lite!</a></li>
<li><a href="https://github.com/joyent/node/wiki/Installation">Building and Installing Node.js</a></li>
<li><a href="https://github.com/Pita/etherpad-lite#readme">Etherpad Lite Readme</a></li>
<li><a href="http://tnovelli.net/blog/blog.2011-08-27.node-npm-user-install.html">Node.js HOWTO: Install NPM as user (not root)</a></li>
<li><a href="http://mclear.co.uk/2011/08/01/install-etherpad-lite-on-ubuntu/">Install Etherpad Lite on Ubuntu and Debian</a></li>
<li><a href="http://stackoverflow.com/questions/6514621/npm-install-locally">npm install locally</a></li>
<li><a href="https://github.com/Pita/etherpad-lite/wiki/How-to-put-Etherpad-Lite-behind-a-reverse-Proxy">How to put Etherpad Lite behind a reverse Proxy</a></li>
<li><a href="http://howtonode.org/deploying-node-upstart-monit">Deploying Node.js With Upstart and Monit</a></li>
<li><a href="http://kevin.vanzonneveld.net/techblog/article/run_nodejs_as_a_service_on_ubuntu_karmic/">Run Node.js as a Service on Ubuntu</a></li>
<li><a href="https://github.com/Pita/etherpad-lite/wiki/How-to-deploy-Etherpad-Lite-as-a-service">How to deploy Etherpad Lite as a service</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://raphael.kallensee.name/journal/etherpad-lite-auf-ubuntu-server-apache-upstart/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Server Name Indication (SNI) mit Ubuntu 10.04 (&#8220;Lucid Lynx&#8221;)</title>
		<link>http://raphael.kallensee.name/journal/server-name-indication-sni-mit-ubuntu-10-04-lucid-lynx/</link>
		<comments>http://raphael.kallensee.name/journal/server-name-indication-sni-mit-ubuntu-10-04-lucid-lynx/#comments</comments>
		<pubDate>Tue, 29 Jun 2010 22:47:04 +0000</pubDate>
		<dc:creator>Raphael Kallensee</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://raphael.kallensee.name/journal/?p=257</guid>
		<description><![CDATA[Bei &#8220;Name-based virtual hosts&#8221; in Verbindung mit SSL gibt es ein Problem: &#8220;by design&#8221; war es nicht möglich, mehrere virtuelle SSL-Hosts mit unterschiedlichen Domains und Zertifikaten parallel auf einer IP-Adresse und demselben Port zu betreiben. Problem ist, dass zuerst zwischen Client und Server die verschlüsselte Verbindung aufgebaut wird (bei der das Zertifikat bereits benötigt wird). [...]]]></description>
			<content:encoded><![CDATA[<p>Bei &#8220;Name-based virtual hosts&#8221; in Verbindung mit SSL gibt es ein Problem: &#8220;by design&#8221; war es nicht möglich, mehrere virtuelle SSL-Hosts mit unterschiedlichen Domains und Zertifikaten parallel auf einer IP-Adresse und demselben Port zu betreiben. Problem ist, dass zuerst zwischen Client und Server die verschlüsselte Verbindung aufgebaut wird (bei der das Zertifikat bereits benötigt wird). Erst anschließend werden die HTTP-Header über die verschlüsselte Verbindung gesendet, in denen dann auch der Hostname steht, der jetzt möglicherweise aber gar nicht mehr zum Zertifikat passt. Einzige Lösung war bisher, pro SSL-IP eine eigene IP-Adresse (bzw. notfalls einen anderen Port) zu verwenden.</p>
<p>Abhilfe gibt es theoretisch bereits seit mehreren Jahren: <a href="http://wiki.apache.org/httpd/NameBasedSSLVHostsWithSNI">Server Name Indication (SNI)</a> ist eine Erweiterung des SSL-Protokolls, bei der einfach bereits beim Verbindungsaufbau vor dem SSL-Handshake der gewünschte Hostname mitgesendet wird.</p>
<p>Serverseitig benötigt diese Erweiterung insbesondere OpenSSL ab Version 0.9.8f sowie Apache ab 2.2.12 &#8211; außerdem müssen beim Kompilieren diverse Flags gesetzt sein. Seit Ubuntu 9.10 &#8220;Karmic Koala&#8221; sind sämtliche Voraussetzungen erfüllt, ich habe SNI nun erstmalig problemlos mit 10.04 &#8220;Lucid Lynx&#8221; im Einsatz. SNI funktioniert mit Apache und OpenSSL nun ohne Neu-Kompilieren &#8220;out of the box&#8221;.</p>
<p>Die Vorgehensweise ist im Prinzip ganz einfach: nach einem</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">NameVirtualHost</span> *:<span style="color: #ff0000;">443</span></pre></div></div>

<p>können in den Apache-Konfigurationsdateien mehrere virtuelle SSL-Hosts definiert werden, die jeweils eigene SSL-Zertifikate besitzen. Weitere Infos sind im <a href="http://wiki.apache.org/httpd/NameBasedSSLVHostsWithSNI#Examples">Apache-Wiki</a> sowie <a href="http://langui.sh/2009/11/03/ssl-vhosting-on-the-same-ip-aka-sni/">hier</a> zu finden.</p>
<p>Eine weitere Option erlaubt das Erzwingen von SNI: übermittelt ein Client nicht die SNI-Header, kann er den jeweiligen virtuellen SSL-Host nicht erreichen. Diese Option ist standardmäßig auf &#8220;off&#8221;.</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;">SSLStrictSNIVHostCheck <span style="color: #0000ff;">on</span></pre></div></div>

<p>Der Haken: neben dem Server muss natürlich auch der Client SNI unterstützen. Internet Explorer unter Windows XP unterstützen SNI generell nicht (wobei es <a href="http://daniel-lange.com/archives/2-Multiple-Apache-VHosts-on-the-same-IP-and-port.html">Berichte</a> gibt, dass mit XP SP3 die Unterstützung vorhanden ist), Konqueror beherrscht SNI ebenfalls nicht. Ein Überblick über die Browser-Unterstützung findet sich <a href="http://www.alexanderkiel.net/2008/04/22/status-of-tls-sni/">hier</a>. Ob ein Browser SNI unterstützt, kann man bei <a href="https://dave.sni.velox.ch/">sni.velox.ch</a> testen.</p>
<p>Zumindest in einigen Bereichen kann man SNI trotz der teilweise fehlenden Client-Kompatibilität bereits einsetzen &#8211; die client-seitige Unterstützung wird sich in Zukunft weiterhin verbessern.</p>
<p>Ein Artikel zum Thema ist in der c&#8217;t 23/09 erschienen und ebenfalls bei <a href="http://sni.velox.ch/ct_2309_Apache_TLS_SNI.pdf">sni.velox.ch</a> zu finden.</p>
]]></content:encoded>
			<wfw:commentRss>http://raphael.kallensee.name/journal/server-name-indication-sni-mit-ubuntu-10-04-lucid-lynx/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>WordPress 2.6 und Permalink-Problem</title>
		<link>http://raphael.kallensee.name/journal/wordpress-26-und-permalink-problem/</link>
		<comments>http://raphael.kallensee.name/journal/wordpress-26-und-permalink-problem/#comments</comments>
		<pubDate>Tue, 15 Jul 2008 19:41:39 +0000</pubDate>
		<dc:creator>Raphael Kallensee</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[WebDevelopment]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.kallensee.info/journal/?p=88</guid>
		<description><![CDATA[Zuerst: WordPress 2.6 ist da! Mit tollen neuen Features (Revisionierung von Beiträgen!), aber leider auch Bugs. Nach meinem Upgrade konnte ich leider Permalinks zu Artikeln nicht mehr erreichen (das offizielle Theme gibt eine 404er-Fehlermeldung), die Übersicht samt Paging und Permalinks zu Kategorien und Tags sowie &#8220;Seiten&#8221; waren erreichbar. Zur Erklärung: ich verwendete keine mod_rewrite-Permalinks, sondern [...]]]></description>
			<content:encoded><![CDATA[<p>Zuerst: <a href="http://wordpress.org/development/2008/07/wordpress-26-tyner/">WordPress 2.6 ist da</a>! Mit tollen neuen Features (Revisionierung von Beiträgen!), aber leider auch Bugs.</p>
<p>Nach meinem Upgrade konnte ich leider Permalinks zu Artikeln nicht mehr erreichen (das offizielle Theme gibt eine 404er-Fehlermeldung), die Übersicht samt Paging und Permalinks zu Kategorien und Tags sowie &#8220;Seiten&#8221; waren erreichbar.</p>
<p>Zur Erklärung: ich verwendete keine mod_rewrite-Permalinks, sondern die PATHINFO-Permalinks im Stil</p>
<blockquote><p>http://www.kallensee.info/journal/<b>index.php</b>/2008/08/22/test-beitrag</p></blockquote>
<p>Nur bei diesen Permalinks, in denen die index.php vorkommt, tritt auch der Fehler auf.</p>
<p>Das Problem ist auch bereits <a href="http://wordpress.org/support/topic/189058">bekannt</a>. Ein Workaround wäre, in der Konfiguration unter Permalinks für Tags und Kategorien eine &#8220;Basis&#8221; einzutragen (ganz unten). Dadurch ändern sich allerdings Links zu Tags und Kategorien.</p>
<p>Ich habe den Bug gleich dazu genutzt, meine Permalinks auf die mod_rewrite-Variante umzustellen und von unnötigen Informationen zu bereinigen. Der <a href="http://seo2.0.onreact.com/top-10-fatal-url-design-mistakes">SEO Blog</a> brachte mich auf den Gedanken, dass die Datumsangabe in der URL ziemlich unnötig ist.</p>
<p>Das neue Permalink-Schema für Artikel ist deutlich schlanker als zuvor:</p>
<blockquote><p>http://www.kallensee.info/journal/test-beitrag</p></blockquote>
<p>Jetzt ist es natürlich an der Zeit, sich um die alten URLs zu kümmern. Alle Links &#8211; bis auf die Beitrags-Permalinks &#8211; werden von WordPress automatisch vom alten Format auf die neue Link-Struktur umgeleitet &#8211; Tags, Archive usw. Wichtig sind natürlich aber vor allem die Beitrags-Permalinks &#8211; die ja bei Google und anderen Blogs noch im alten Permalink-Format vorliegen. Damit die nicht auf einer Fehlerseite landen, habe ich in meine Apache-Konfiguration für den entsprechenden Host eine RedirectMatch-Direktive eingefügt:</p>
<blockquote><p>
RedirectMatch permanent ^/journal/index.php/200(6|7|8)/[0-9][0-9]/[0-9][0-9]/([A-Za-z0-9-/#]*) http://www.kallensee.info/journal/$2
</p></blockquote>
<p>Diese Direktive leitet alle Anfragen auf Beiträge des alten URL-Formats auf das neue Format um. Im Test werden aber alle URL&#8217;s korrekt umgeleitet. Wichtig: durch den Parameter &#8220;permanent&#8221; erfolgt die Weiterleitung mit dem HTTP-Statuscode 301, auf Deutsch: dem Anfragenden wird neben der neuen Adresse mitgeteilt, dass die Seite permanent &#8220;verzogen&#8221; ist. Für Suchmaschinen äußerst wichtig zu wissen.</p>
<p>Für Verbesserungsvorschläge bin ich jederzeit offen &#8211; zumindest optimieren kann man den regulären Ausdruck mit Sicherheit&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://raphael.kallensee.name/journal/wordpress-26-und-permalink-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache-Fehler: pcfg_openfile: unable to check htaccess file</title>
		<link>http://raphael.kallensee.name/journal/apache-fehler-pcfg_openfile-unable-to-check-htaccess-file/</link>
		<comments>http://raphael.kallensee.name/journal/apache-fehler-pcfg_openfile-unable-to-check-htaccess-file/#comments</comments>
		<pubDate>Tue, 15 Apr 2008 12:59:00 +0000</pubDate>
		<dc:creator>Raphael Kallensee</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[WebDevelopment]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.kallensee.info/journal/?p=77</guid>
		<description><![CDATA[Nachdem aus unerklärlichen Gründen ein Teil meines Webservers nicht mehr erreichbar war und der Browser immer meldete, dass der Zugriff auf das Verzeichnis nicht möglich sei, habe ich in den Apache-Error-Logs folgendes gefunden: (13)Permission denied: /var/www/[...]/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable Kam mir unbekannt vor &#8211; und obwohl die Fehlermeldung [...]]]></description>
			<content:encoded><![CDATA[<p>Nachdem aus unerklärlichen Gründen ein Teil meines Webservers nicht mehr erreichbar war und der Browser immer meldete, dass der Zugriff auf das Verzeichnis nicht möglich sei, habe ich in den Apache-Error-Logs folgendes gefunden:</p>
<blockquote><p>(13)Permission denied: /var/www/[...]/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable</p></blockquote>
<p>Kam mir unbekannt vor &#8211; und obwohl die Fehlermeldung recht aussagekräftig war, kam ich erst <a href="http://wolf-u.li/693/apache-fehler-pcfg_openfile-fehler-13-beheben/">hier</a> auf die Spur: das Verzeichnis (bzw. schon ein Verzeichnis einige Ebenen tiefer) war für den Apache-User einfach nicht lesbar&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://raphael.kallensee.name/journal/apache-fehler-pcfg_openfile-unable-to-check-htaccess-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

