Difference between revisions of "Wifi kiosk"

From Kiwix
Jump to navigation Jump to search
(wikification)
Line 1: Line 1:
This page is a HOWTO to create a Kiwix '''Wifi kiosk''', a simple wifi hotspot which allow user to surf on Wikipedia using kiwix-serve and also provide all necessary files to download.
This page is a HOWTO to create a Kiwix '''Wifi kiosk''', a simple wifi hotspot which allow user to surf on Wikipedia using [[kiwix-serve]] and also provide all necessary files to download.


== 1 - Hardware ==
== 1 - Hardware ==

Revision as of 13:02, 22 June 2015

This page is a HOWTO to create a Kiwix Wifi kiosk, a simple wifi hotspot which allow user to surf on Wikipedia using kiwix-serve and also provide all necessary files to download.

1 - Hardware

Almost all hardware may be able to help to build such a wifi hotspot. We use a small PC based on a x86 and using a USB wifi dongle. To install Debian on the computer, we use an additional USB HD.

2 - OS Installation

Install unetbootin and start it. unetbootin propose you to install a debian unstable netinstall on your USB key, do it. Boot your target computer on the usb key and install Debian choosing the options "Web server" and "SSH server".

3 - Install additional packages

You should now be able to connect to you computer using SSH, you may consequently to all the next steps remotly. Install the following packags : wireless-tools, dnsmasq Check that you wirelss card is correctly recognized.

4 - Configuration network

Add to the /etc/network/interfaces

# wlan
auto wlan0
iface wlan0 inet static
address 192.168.1.1
netmask 255.255.255.0
wireless-essid KIWIX
wireless-mode ad-hoc

Try to start the interface with: ifconfig wlan0 up

5 - Configuration of DNS & DHCP

Enable the option in /etc/dnsmasq.conf :

  • bogus-priv
  • address = /#/192.168.1.1
  • interface=wlan0
  • dhcp-range=192.168.1.50,192.168.1.150,1h

At this moment you should be able to freely connect to the KIWIX hotspot and your web browser should display for any request the default Apache web page.

6 - Configuration of Apache

You have to create a vhost for kiwix in the file /etc/apache2/sites-available/kiwix like following.

<VirtualHost *:80>
        ServerName kiwix
        DocumentRoot /var/www/kiwix/
</VirtualHost>

In /etc/apache2/sites-available/default, add the following lines:

<Ifmodule mod_alias.c>
	RedirectMatch permanent /(.*)$ http://kiwix/
</IfModule>

Create the directory /var/www/kiwix and an empty file /var/www/kiwix/index.html

Create a symbolic link in /etc/apache2/sites-enabled/ and reload Apache.

At this moment all the HTTP request should target to http://kiwix/

7 - install kiwix-serve with content

Compile and install kiwix-serve or install it from a package.

Choose the content (ZIM file) you want to serve and index it with kiwix-index.

Start kiwix-serve on the port 4201. So you should be typing on your client http://kiwix:4201 get the page served by kiwix-serve.

Add the kiwix-serve to the init.d following this documentation.

8 - Integrate kiwix-serve and Apache with mod_proxy

Activate mod_proxy with "a2enmod proxy proxy_http rewrite"

Insert in the kiwix vhost file:

RewriteEngine On
RewriteRule   ^/(.{1}/.*)$  /wp/$1  [R]
RewriteRule   ^/(search?.*)$  /wp/$1  [R]

<Location /wp/>
ProxyPass http://kiwix:4201/
SetEnv force-proxy-request-1.0 1
SetEnv proxy-nokeepalive 1
</Location>

8(alt) - Integrate kiwix-serve with Nginx

Nginx is faster and less resources consuming than Apache in this scenario. This step overrides step 6. If you installed Apache, you can remove it.

  • Install nginx: aptitude install nginx
  • Edit /etc/nginx/sites-available/default, adding the following:
server_name localhost kiwix;
root /var/www/kiwix;
location /wp {
  rewrite /wp/(.*) /$1 break;
  proxy_pass        http://localhost:4201;
  proxy_set_header  X-Real-IP  $remote_addr;
}
rewrite ^/(.)/(.*)$ /wp/$1/$2 last;
rewrite ^/search(.*)$ /wp/search$1 last;
location /download/ {
  alias /home/downloads/;
}
error_page   404 = /;

Now you should get the kiwix-serve rendered page by typing http://kiwix/wp/

9 - Welcome pages

Create your welcome pages in HTML. Here is a stub:

<html>
<head>
  <title>Kiwix Wifi Kiosk</title>
</head>
<body>
<ul>
<li><a href="/wp/">Surf on Wikipedia</a></li>
<li><a href="/download/kiwix.tar.bz2">Download Kiwix</a></li>
<li><a href="/download/wikipedia.zim">Download Wikipedia</a></li>
</ul>
</body>
</html>

Bugs

See also