Etherbox

From ActiveArchives
Jump to: navigation, search

Contents

Context

The idea of an "etherbox" arose from experiences developing local-server infrastructures for collaboration for working sessions organized by Constant ASBL. This (as of 2018) still in development project is documented here.


Copy the starting image

Downloaded from https://www.raspberrypi.org/downloads/raspbian/

Based on the "lite" image (zip or torrent). As of 20 Jan 2018, this is Raspian "Stretch" lite.

The **lite** image has no desktop / windows session.

Based on 2017-04-10-raspian-jessie-lite.zip

unzip -p 2017-04-10-raspbian-jessie-lite.zip | pv | sudo dd of=/dev/sdc bs=4M

You could use Etcher.io as well

Enable SSH

SSH is no longer on by default!

Before putting the SD card in the pi, you can enable ssh. Just create a empty file named "ssh" and save it in the /boot partition of the SD Card.

So mount the SD card and

 cd /media/USERNAME/boot
 touch ssh

Otherwise, you can connect with a screen and run:

sudo raspi-config

Then enable ssh under connectivity.

Setup hotspot

Following <https://www.raspberrypi.org/documentation/configuration/wireless/access-point.md#internet-sharing>

Noted on installing dnsmasq that:

   /etc/systemd/system/multi-user.target.wants/dnsmasq.servce -> /lib/systemd/system/dnsmasq.service

``` sudo apt-get install dnsmasq hostapd ```

Since the configuration files are not ready yet, turn the new software off as follows:

``` sudo systemctl stop dnsmasq sudo systemctl stop hostapd ```

Configuring a static IP

We are configuring a standalone network to act as a server, so the Raspberry Pi needs to have a static IP address assigned to the wireless port. This documentation assumes that we are using the standard 192.168.x.x IP addresses for our wireless network, so we will assign the server the IP address 192.168.4.1. It is also assumed that the wireless device being used is wlan0.

To configure the static IP address, edit the dhcpcd configuration file with:

``` sudo nano /etc/dhcpcd.conf ```

Go to the end of the file and edit it so that it looks like the following:


``` interface wlan0

   static ip_address=192.168.4.1/24
   nohook wpa_supplicant

```

Now restart the dhcpcd daemon and set up the new wlan0 configuration:

``` sudo service dhcpcd restart ```

Configuring the DHCP server (dnsmasq)

The DHCP service is provided by dnsmasq. By default, the configuration file contains a lot of information that is not needed, and it is easier to start from scratch. Rename this configuration file, and edit a new one:

``` sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig sudo nano /etc/dnsmasq.conf ```

Type or copy the following information into the dnsmasq configuration file and save it:


``` interface=wlan0 # Use the require wireless interface - usually wlan0

 dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h

```

So for wlan0, we are going to provide IP addresses between 192.168.4.2 and 192.168.4.20, with a lease time of 24 hours. If you are providing DHCP services for other network devices (e.g. eth0), you could add more sections with the appropriate interface header, with the range of addresses you intend to provide to that interface.

There are many more options for dnsmasq; see the dnsmasq documentation for more details.


Configuring the access point host software (hostapd)

You need to edit the hostapd configuration file, located at /etc/hostapd/hostapd.conf, to add the various parameters for your wireless network. After initial install, this will be a new/empty file.

sudo nano /etc/hostapd/hostapd.conf

Add the information below to the configuration file. This configuration assumes we are using channel 7, with a network name of NameOfNetwork, and a password AardvarkBadgerHedgehog. Note that the name and password should not have quotes around them. The passphrase should be between 8 and 64 characters in length.

interface=wlan0 driver=nl80211 ssid=NameOfNetwork hw_mode=g channel=7 wmm_enabled=0 macaddr_acl=0 auth_algs=1 ignore_broadcast_ssid=0 wpa=2 wpa_passphrase=AardvarkBadgerHedgehog wpa_key_mgmt=WPA-PSK wpa_pairwise=TKIP rsn_pairwise=CCMP

We now need to tell the system where to find this configuration file.

sudo nano /etc/default/hostapd

Find the line with #DAEMON_CONF, and replace it with this:

DAEMON_CONF="/etc/hostapd/hostapd.conf"


Start it up

Now start up the remaining services:

``` sudo systemctl start hostapd sudo systemctl start dnsmasq ```


Add routing and masquerade

Edit /etc/sysctl.conf and uncomment this line:

net.ipv4.ip_forward=1

Add a masquerade for outbound traffic on eth0:

sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

Save the iptables rule.

sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"

Edit /etc/rc.local and add this just above "exit 0" to install these rules on boot.

iptables-restore < /etc/iptables.ipv4.nat

Reboot

Find the IP address of the pi

Simplest way is to connect on a wired network that has DHCP and plug both the pi and your laptop into a router with ethernet cables, then type:

   ping raspberrypi.local

And you should be able to see the IP address.

Then you can connect with ssh with either:

   ssh pi@raspberrypi.local

or with the IP address in place of "raspberrypi.local" if you are on the wifi.

Login with the default password "raspberry"

Make it easier to login, with an ssh key

Starting from your laptop (open a new Terminal session if you are connected to the pi):

   ssh-keygen

Choose the defaults. This generates an "ssh key" pair.

Use the ssh-copy-id utility to send it to the pi.

   ssh-copy-id pi@raspberrypi.local

Bring the rest of the software up to date

sudo apt-get update
sudo apt-get upgrade

Change hostname from raspberrypi to etherbox

In 2 places:

   sudo nano /etc/hostname
   sudo nano /etc/hosts

change to:

127.0.0.1       localhost
::1             localhost ip6-localhost ip6-loopback
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters

127.0.1.1       etherbox

Best to reboot after this, otherwise it gives warnings all the time.

sudo reboot

Assign Static Ip Adress to the Pi

For that, you need to modify a file named 'dhcpcd.conf'. But first, you need to backup this file :

cd /etc/
sudo cp dhcpcd.conf ddhcpcd.conf.original

Then modify the 'dhcpcd.conf' :

 sudo nano dhcpcd.conf

Then find this and replace (with your value) :

# Example static IP configuration:
interface eth0
static ip_address=192.168.1.5/24
#static ip6_address=fd51:42f8:caae:d92e::ff/64
static routers=192.168.1.1
static domain_name_servers=192.168.1.1

Where 192.168.1.5/24 is the new Ip address of your Pi.

At last, reboot your Pi :

sudo reboot

Setup apache to serve the root with custom header + readme's

sudo apt-get install apache2
cd /etc/apache2/sites-available
sudo nano 000-default.conf
    ServerAdmin webmaster@localhost
    # DocumentRoot /var/www/html
    DocumentRoot /home/pi/www
    <Directory /home/pi/www>
           Options Indexes FollowSymLinks
           AllowOverride none
           Require all granted
    </Directory>

    HeaderName /include/HEADER.shtml
    ReadmeName README.html

NB: Sets the HeaderName and ReadmeName directives (part of mod_autoindex).

sudo service apache2 reload

droptoupload.cgi

Drop to upload is a CGI python script that allows users to drop files to upload them in the apache directory listings.

First enable the cgi-bin with apache

sudo a2enmod cgi
sudo systemctl restart apache2

Download the script to the cgi-bin.

   cd /usr/lib/cgi-bin
   sudo wget https://gitlab.constantvzw.org/aa/etherbox/raw/master/usr/lib/cgi-bin/droptoupload.cgi
   sudo chmod +x droptoupload.cgi


You can test running it with...

./droptoupload.cgi

Like this is just outputs an HTML form. Looking at http://etherbox.local/cgi-bin/droptoupload.cgi should also display an upload form.

The HEADER.shtml (next step) includes a link to this cgi.

/home/pi/include/HEADER.shtml

nano /home/pi/include/HEADER.shtml

(don't use sudo)

Invalid language.

You need to specify a language like this: <source lang="html4strict">...</source>

Supported languages for syntax highlighting:

4cs, 6502acme, 6502kickass, 6502tasm, 68000devpac, abap, actionscript, actionscript3, ada, algol68, apache, applescript, apt_sources, asm, asp, autoconf, autohotkey, autoit, avisynth, awk, bascomavr, bash, basic4gl, bf, bibtex, blitzbasic, bnf, boo, c, c_loadrunner, c_mac, caddcl, cadlisp, cfdg, cfm, chaiscript, cil, clojure, cmake, cobol, coffeescript, cpp, cpp-qt, csharp, css, cuesheet, d, dcs, delphi, diff, div, dos, dot, e, ecmascript, eiffel, email, epc, erlang, euphoria, f1, falcon, fo, fortran, freebasic, fsharp, gambas, gdb, genero, genie, gettext, glsl, gml, gnuplot, go, groovy, gwbasic, haskell, hicest, hq9plus, html4strict, html5, icon, idl, ini, inno, intercal, io, j, java, java5, javascript, jquery, kixtart, klonec, klonecpp, latex, lb, lisp, llvm, locobasic, logtalk, lolcode, lotusformulas, lotusscript, lscript, lsl2, lua, m68k, magiksf, make, mapbasic, matlab, mirc, mmix, modula2, modula3, mpasm, mxml, mysql, newlisp, nsis, oberon2, objc, objeck, ocaml, ocaml-brief, oobas, oracle11, oracle8, oxygene, oz, pascal, pcre, per, perl, perl6, pf, php, php-brief, pic16, pike, pixelbender, pli, plsql, postgresql, povray, powerbuilder, powershell, proftpd, progress, prolog, properties, providex, purebasic, pycon, python, q, qbasic, rails, rebol, reg, robots, rpmspec, rsplus, ruby, sas, scala, scheme, scilab, sdlbasic, smalltalk, smarty, sql, systemverilog, tcl, teraterm, text, thinbasic, tsql, typoscript, unicon, uscript, vala, vb, vbnet, verilog, vhdl, vim, visualfoxpro, visualprolog, whitespace, whois, winbatch, xbasic, xml, xorg_conf, xpp, yaml, z80, zxbasic


<script src="/cgi-bin/droptoupload.cgi"></script>
<style>
body {
background: #38b8e9;
color: black;
}
a {
color: white;
}
#logo {
white-space: pre;
font-family: monospace;
}
</style>
<div class="links" style="margin-bottom: 1em">LOCAL:
<a href="/">home</a>
<a href="/" onclick="javascript:event.target.port=9001">etherpad</a>
<a href="/etherdump/index2.html">etherdump</a>
PUBLIC:
<a href="http://erg.be/">erg</a>
<a href="http://erg.activearchives.org/mw/index.php/Etherbox">mode d'emploi</a>
</div>
<style>
.links {
font-family: monospace;
text-transform: uppercase;
</style>
<script>
document.addEventListener("DOMContentLoaded", function () {
  var p = document.querySelectorAll(".top"),
      t = document.getElementsByTagName("table")[0];
  for (var i=0, l=p.length; i<l; i++) {
    document.body.insertBefore(p[i], t);
  }
});
</script>

Better permissions with facl

setfacl

sudo apt install acl
sudo addgroup pi www-data

sudo setfacl -Rm g:www-data:rwX /home/pi/www
sudo setfacl -d -Rm g:www-data:rwX /home/pi/www

Unfortunately, I had problems then with permissions on the .ssh folder (preventing keys to be used). To remove the fact on just this folder:

sudo chmod g-w /home/pi

Install etherpad

And the version of "nodejs" is now 0.10.29~dfsg-2. So let's try it with etherpad...

sudo apt-get install npm git

sudo ln -s /usr/bin/nodejs /usr/bin/node

cd /opt
sudo git clone https://github.com/ether/etherpad-lite.git
sudo mv etherpad-lite etherpad

# TODO: don't create home folder! ... find option
sudo adduser --system --no-create-home --home=/opt/etherpad --group etherpad
sudo chown -R etherpad:etherpad etherpad

Les fichiers se trouvent dans opt/etherpad/var sous forme d'un seul fichier "dirtyDB" - > You should use a dedicated database such as "mysql", if you are planning on using etherpad-in a production environment.

Create your setting file.

cd etherpad
sudo --user etherpad cp settings.json.template settings.json

then, desactivate the dirty.db file and configure the mysql database

sudo --user etherpad nano settings.json

Find and change this part :

  //The Type of the database. You can choose between dirty, postgres, sqlite and mysql
  //You shouldn't use "dirty" for for anything else than testing or development
 /* "dbType" : "dirty",
  //the database specific settings
  "dbSettings" : {
                   "filename" : "var/dirty.db"
                 },
*/
  //An Example of MySQL Configuration
   "dbType" : "mysql",
   "dbSettings" : {
                    "user"    : "etherpaduser",
                    "host"    : "localhost",
                    "password": "etherpadpass",
                    "database": "etherpad",
                    "charset" : "utf8mb4"
                  },

Set up Mysql

First thing to do is to install MySQL :

sudo apt-get install mysql-server

Then create the database, for this we need to login with the Root user (super-user) :

sudo su

Run mysql  :

mysql

Then create the database and the user 'etherpaduser' with the password 'etherpadpass' :

create database etherpad;
grant all on etherpad.* to 'etherpaduser'@'localhost' identified by 'etherpadpass';

Use Ctrl-D to quit mysql. And exit to quit su.

Just to test if it works :

mysql -u etherpaduser -p etherpad

Run etherpad for the first time as the etherpad user...

cd /opt/etherpad
sudo --user etherpad bin/run.sh

The first time you run the etherpad software it takes a **long** time as it downloads related packages. It may also give quite some warnings, but hopefully no errors.

Setup etherpad to start as a service

sudo nano /etc/systemd/system/etherpad.service
[Unit]
Description=Etherpad-lite, the collaborative editor.
After=syslog.target network.target

[Service]
Type=simple
User=etherpad
Group=etherpad
WorkingDirectory=/opt/etherpad
ExecStart=/usr/bin/nodejs /opt/etherpad/node_modules/ep_etherpad-lite/node/server.js
Restart=always

[Install]
WantedBy=multi-user.target

After this, to start once...

sudo systemctl start etherpad

Check if it's working with:

sudo systemctl status etherpad

And finally automatically start on boot:

sudo systemctl enable etherpad

Change the welcome text

sudo --user etherpad nano settings.json

If you want to keep the pad private, add the __NOPUBLISH__ tag into the body text

etherdump

Etherdump is a script that dumps all pads to different format text files. It's run periodically by a cron job to create a running archive of the etherpads.

Install deps:

sudo apt install python3-pip
sudo pip3 install python-dateutil jinja2 html5lib

Install from repo:

cd
mkdir Software
cd Software
git clone http://murtaugh@gitlab.constantvzw.org/aa/etherdump.git
cd etherdump
sudo python3 setup.py install

Init the folder

You need the etherpad API key (which is generated the first time you ran the software, see above). Copy it from:

cat /opt/etherpad/APIKEY.txt

Then...

cd /home/pi
mkdir etherdump
cd etherdump
etherdump init

For the URL use: http://192.168.1.5:9001/

And paste the API key.

Use pandoc to convert pads to HTML

Pandoc is used to convert markdown files to HTML.

   sudo apt-get install pandoc

Create an image gallery with imagemagick

Imagemagick to make thumbnails.

   sudo apt-get install imagemagick

cron.sh

nano /home/pi/cron.sh
# Dump the etherpad to files
cd etherdump
etherdump pull --meta --text --dhtml --pub . --no-raw-ext
etherdump index \
  *.meta.json \
  --templatepath /home/pi/include \
  --template etherdump.template.html \
  --title "Erg etherdump" > index2.html
# Run the makefile
cd /home/pi
make

Make it executable:

chmod +x /home/pi/cron.sh

makefile

The makefile defines the "recipe" that turns the pads (when they are named something.md) into HTML. The "%.html: %.md" is an "implicit rule" that defines how any ".md" file (right hand side, or pre-requesite, can be turned into a ".html" file (left hand side, or "target" in the language of the makefile. For this kind of rule the special variables can be really useful (like $< and $@).

This makefile uses the pandoc program to convert markdown to html. This program has LOTS of options is quite powerful. Good documenation on the markdown format, and how pandoc supports it is: http://pandoc.org/MANUAL.html#pandocs-markdown

nano /home/pi/makefile
mdsrc=$(shell ls etherdump/*.md)
htmldest=$(mdsrc:%.md=%.html)
 
all: $(htmldest)
# $< is the right part input prereq    $@ is the target 
%.html: %.md
	pandoc --from markdown \
		--standalone \
		--section-divs \
		--smart \
		--css styles.css \
		--to html5 \
		$< -o $@

include/etherdump.template.html

Invalid language.

You need to specify a language like this: <source lang="html4strict">...</source>

Supported languages for syntax highlighting:

4cs, 6502acme, 6502kickass, 6502tasm, 68000devpac, abap, actionscript, actionscript3, ada, algol68, apache, applescript, apt_sources, asm, asp, autoconf, autohotkey, autoit, avisynth, awk, bascomavr, bash, basic4gl, bf, bibtex, blitzbasic, bnf, boo, c, c_loadrunner, c_mac, caddcl, cadlisp, cfdg, cfm, chaiscript, cil, clojure, cmake, cobol, coffeescript, cpp, cpp-qt, csharp, css, cuesheet, d, dcs, delphi, diff, div, dos, dot, e, ecmascript, eiffel, email, epc, erlang, euphoria, f1, falcon, fo, fortran, freebasic, fsharp, gambas, gdb, genero, genie, gettext, glsl, gml, gnuplot, go, groovy, gwbasic, haskell, hicest, hq9plus, html4strict, html5, icon, idl, ini, inno, intercal, io, j, java, java5, javascript, jquery, kixtart, klonec, klonecpp, latex, lb, lisp, llvm, locobasic, logtalk, lolcode, lotusformulas, lotusscript, lscript, lsl2, lua, m68k, magiksf, make, mapbasic, matlab, mirc, mmix, modula2, modula3, mpasm, mxml, mysql, newlisp, nsis, oberon2, objc, objeck, ocaml, ocaml-brief, oobas, oracle11, oracle8, oxygene, oz, pascal, pcre, per, perl, perl6, pf, php, php-brief, pic16, pike, pixelbender, pli, plsql, postgresql, povray, powerbuilder, powershell, proftpd, progress, prolog, properties, providex, purebasic, pycon, python, q, qbasic, rails, rebol, reg, robots, rpmspec, rsplus, ruby, sas, scala, scheme, scilab, sdlbasic, smalltalk, smarty, sql, systemverilog, tcl, teraterm, text, thinbasic, tsql, typoscript, unicon, uscript, vala, vb, vbnet, verilog, vhdl, vim, visualfoxpro, visualprolog, whitespace, whois, winbatch, xbasic, xml, xorg_conf, xpp, yaml, z80, zxbasic


<!DOCTYPE html>
<html lang="{{language}}">
<head>
	<meta charset="utf-8" />
	<!-- for controlling google robots.txt settings -->
	<meta name="google-site-verification" content="Ro8-A1t6QCIzTm_O49iqKED8YbvVnMELgdKDjy1bnqc" />
	<title>{{title}}</title>
	<link rel="stylesheet" type="text/css" href="{%block css %}styles.css{%endblock%}">
	<link rel="alternate" type="application/rss+xml" href="recentchanges.rss">
	{% block scripts %}
	<script src="jquery-latest.js"></script>
	<script src="jquery.tablesorter.min.js"></script>
	{% endblock scripts %}
</head>
<body>
<h2 id="title">{{title}}</h2>
<p><em>To hide a pad from this listing, use the __NOPUBLISH__ tag.</em></p>
<p>Last updated {{timestamp}}.</p>

<script src="index.js"></script>

<table class="listing tablesorter">
<thead>
<tr>
	<th>name</th>
	<th>versions</th>
	<th>last edited</th>
	<th>revisions</th>
	<th>authors</th>
</tr>
</thead>
<tbody>
{% for pad in pads %}
<tr>
	<td class="name">
		<a href="{{pad.link}}">{{ pad.padid }}</a>
	</td>
	<td class="versions"> 
		{% for v in pad.versions %}<a href="{{v.url}}">{{v.type}}</a> {% endfor %}
		{% if pad.padid.endswith(".md") %}<a href="{{pad.padid.split(".", 1)[0]}}.html">html</a>{% endif %}
	</td>
	<td class="lastedited">{{ pad.lastedited_iso|replace("T", " ") }}</td>
	<td class="revisions">{{ pad.revisions }}</td>
	<td class="authors">{{ pad.author_ids|length }}</td>
</tr>
{% endfor %}
</tbody>
</table>

</body>
</html>

Enable the cron job

crontab -e

The following runs the cron.sh every minute.

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin$
 
# For more information see the manual pages of crontab(5) and cro$
#
# m h  dom mon dow   command
* * * * * /home/pi/cron.sh 2> /home/pi/cron.log

Create a pagekite "backend" (pi)

cd /home/pi/software
wget https://pagekite.net/pk/pagekite.py
chmod +x pagekite.py
sudo nano /etc/systemd/system/pagekite.service
[Unit]
Description=pagekite
After=syslog.target network.target
 
[Service]
Type=simple
User=pi
Group=pi
ExecStart=/home/pi/software/pagekite.py --clean --frontend=etherbox.constantvzw.org:10108 --service_on=http:etherbox.constantvzw.org:localhost:80:secret --service_on=raw-22:etherbox.activearchives.org:22:secret
 
[Install]
WantedBy=multi-user.target

Test:

sudo systemctl start pagekite
sudo systemctl status pagekite

Enable:

sudo systemctl enable pagekite

Which should report that:

Created symlink /etc/systemd/system/multi-user.target.wants/pagekite.service → /etc/systemd/system/pagekite.service.

Create a pagekite tunnel frontend (on a public server)

See: http://activearchives.org/wiki/Making_a_local_server_public_with_pagekite.py

Pagekite tunnel: Server proxy (nginx)

We setup a proxy to get the webserver to pass requests for a cname (etherbox.constantvzw.org) to the particular port where pagekite is running.

/etc/nginx/sites-available/etherbox.constantvzw.org.conf

server {

      listen 80;
      server_name www.etherbox.constantvzw.org etherbox.constantvzw.org;
      location / {
           proxy_pass             http://127.0.0.1:10108;
           proxy_set_header       Host $host;
           proxy_set_header       X-Real-IP $remote_addr;
           proxy_set_header       X-Forwarded-For $proxy_add_x_forwarded_for;
           proxy_set_header       X-Forwarded-Host $host:$server_port;
           proxy_set_header       X-Forwarded-Server $host;
           proxy_redirect         off;
           proxy_buffering        off;
       }

}

Configure your laptop's ssh to use the tunnel

DRAFT

~/.ssh/config

   Host erg.activearchives.org
   CheckHostIP no
   ProxyCommand /usr/bin/corkscrew %h 10107 %h %p

To shutdown the box cleanly

sudo shutdown -h now

To ssh to the pi

From your laptop's terminal:

ssh pi@192.168.1.5

And use the password (standard pi password is 'raspberry').

Get a LEGO case for the pi

See Pi Blox case

Create a reverse proxy for the etherpad

Creating a tunnel to give your local server a public address exposes only the (Apache) webserver (aka traffic on port 80). In order to make the etherpad visible and usable publically, it's possible to create a "reverse proxy" that creates access to the etherpad (on port 9001) via the webserver. To do this we create a special "virtual" location (/pad) and tell apache to redirect traffic to etherpad.

This recipe is based on information found here.

   sudo a2enmod proxy proxy_http headers proxy_wstunnel deflate rewrite


<VirtualHost *:80>
	# The ServerName directive sets the request scheme, hostname and port that
	# the server uses to identify itself. This is used when creating
	# redirection URLs. In the context of virtual hosts, the ServerName
	# specifies what hostname must appear in the request's Host: header to
	# match this virtual host. For the default virtual host (this file) this
	# value is not decisive as it is used as a last resort host regardless.
	# However, you must set it for any further virtual host explicitly.
	#ServerName www.example.com
 
	ServerAdmin webmaster@localhost
	# DocumentRoot /var/www/html
	DocumentRoot /home/pi
    	<Directory /home/pi>
           Options Indexes FollowSymLinks
           AllowOverride none
           Require all granted
    	</Directory>
 
    	HeaderName /include/HEADER.shtml
    	ReadmeName README.html
 
	# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
	# error, crit, alert, emerg.
	# It is also possible to configure the loglevel for particular
	# modules, e.g.
	#LogLevel info ssl:warn
 
	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined
 
	# For most configuration files from conf-available/, which are
	# enabled or disabled at a global level, it is possible to
	# include a line for only one particular virtual host. For example the
	# following line enables the CGI configuration for this host only
	# after it has been globally disabled with "a2disconf".
	#Include conf-available/serve-cgi-bin.conf
 
    # ETHERPAD PROXY
    ProxyVia On
    ProxyRequests Off
    ProxyPreserveHost on
   <Location /pad/>
        ProxyPass http://localhost:9001/ retry=0 timeout=30
        ProxyPassReverse http://localhost:9001/
    </Location>
    <Location /pad/socket.io>
        # This is needed to handle the websocket transport through the proxy, since
        # etherpad does not use a specific sub-folder, such as /ws/ to handle this kind of traffic.
        # Taken from https://github.com/ether/etherpad-lite/issues/2318#issuecomment-63548542
        # Thanks to beaugunderson for the semantics
        RewriteEngine On
        RewriteCond %{QUERY_STRING} transport=websocket    [NC]
        RewriteRule /(.*) ws://localhost:9001/socket.io/$1 [P,L]
        ProxyPass http://localhost:9001/socket.io retry=0 timeout=30
        ProxyPassReverse http://localhost:9001/socket.io
    </Location>
 
    <Proxy *>
      Options FollowSymLinks MultiViews
      AllowOverride All
      Order allow,deny
      allow from all
    </Proxy>
 
</VirtualHost>
 
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

Error messages FAQ

Failed to restart apache2.service: The name org.freedesktop.PolicyKit1 was not provided by any .service files

When you see this you maybe just forgot to sudo, as in:

   sudo systemctl restart apache2
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox