Difference between revisions of "Database/Map/Server"

From Open Maps wiki
Jump to: navigation, search
Line 10: Line 10:
 
sudo apt-get install hostapd
 
sudo apt-get install hostapd
 
sudo apt-get install dnsmasq
 
sudo apt-get install dnsmasq
sudo service nginx start
 
 
</nowiki>
 
</nowiki>
  
 +
== Web Server ==
 +
 +
Set up web server to forward 404's to root directory (needed for captive portal behaviour) and start
 +
edit /etc/nginx/sites-available/default
 +
 +
and modify line in "location / {" section:
 +
<nowiki>
 +
try_files $uri $uri/ = 404;
 +
</nowiki>
 +
becomes
 +
<nowiki>
 +
try_files $uri $uri/ /index.html;
 +
</nowiki>
 +
 +
Now start the server
 +
<nowiki>
 +
sudo service nginx start
 +
</nowiki>
  
 
== Set up hostapd ==
 
== Set up hostapd ==
  
# Set up AP with hostap (instructions from [http://elinux.org/RPI-Wireless-Hotspot set up AP with udhcpd])
+
Set up AP with hostap (instructions from [http://elinux.org/RPI-Wireless-Hotspot set up AP with udhcpd])
 
edit the file /etc/hostapd/hostapd.conf  
 
edit the file /etc/hostapd/hostapd.conf  
 
  <nowiki>
 
  <nowiki>
Line 40: Line 57:
 
  </nowiki>
 
  </nowiki>
  
sudo service hostapd start
+
=== Note for EDIMAX adaptors ===
 +
 
 +
[http://www.daveconroy.com/turn-your-raspberry-pi-into-a-wifi-hotspot-with-edimax-nano-usb-ew-7811un-rtl8188cus-chipset/ edimax version of hostapd if using an edimax wifi usb]
 +
 
  
# [http://www.daveconroy.com/turn-your-raspberry-pi-into-a-wifi-hotspot-with-edimax-nano-usb-ew-7811un-rtl8188cus-chipset/ edimax version of hostapd if using an edimax wifi usb]
+
== DHCP and DNS for access point and captive portal ==
  
# Set up /etc/network/interfaces for serving DHCP and DNS
+
Set up /etc/network/interfaces for serving DHCP and DNS
 
  <nowiki>
 
  <nowiki>
 
auto lo  
 
auto lo  

Revision as of 14:39, 16 April 2016

Lets set up our map server with local cached image files

Installing required software

Install nginx (server), hostapd (wifi AP host), dnsmasq (light dns server) install Nginx

sudo apt-get update
sudo apt-get install nginx
sudo apt-get install hostapd
sudo apt-get install dnsmasq

Web Server

Set up web server to forward 404's to root directory (needed for captive portal behaviour) and start edit /etc/nginx/sites-available/default

and modify line in "location / {" section:

try_files $uri $uri/ = 404;

becomes

try_files $uri $uri/ /index.html;

Now start the server

sudo service nginx start

Set up hostapd

Set up AP with hostap (instructions from set up AP with udhcpd) edit the file /etc/hostapd/hostapd.conf

interface=wlan0
ssid=TacticalSpaceLab
hw_mode=g
channel=6
auth_algs=1
wmm_enabled=0

Edit the file /etc/default/hostapd and change the line:

#DAEMON_CONF=""

to

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

Start it up, and add it to start at boot

sudo service hostapd start
sudo update-rc.d hostapd enable
 

Note for EDIMAX adaptors

edimax version of hostapd if using an edimax wifi usb


DHCP and DNS for access point and captive portal

Set up /etc/network/interfaces for serving DHCP and DNS

auto lo 
iface lo inet loopback 

auto wlan0
iface wlan0 inet static
  address 10.1.2.1
  netmask 255.255.255.0
  network 10.1.2.0


  1. configure dnsmasq /etc/dnsmasq.conf
# captive portal to this
no-resolv 
server=/localnet/10.1.2.1
server=/tacticalspace/10.1.2.1
address=/#/10.1.2.1
interface=wlan0
dhcp-range=10.1.2.5,10.1.2.200,12h

  1. restart dnsmasq
sudo /etc/init.d/dnsmasq restart

  1. if you want dnsmarsq script logging...

Create /var/log/dhcp_leases file with write create /usr/bin/logdhcp, make executable add it to dnsmasq config

#!/bin/bash
destfile=/var/log/dhcp_leases
#if [ "$1" == "add" ]
#then
  if [ -f "$destfile" ]
  then
    echo "$1 $2" >> "$destfile"
  fi
#fi

Logging dhcp.png

ended up using dnsmasq for DNS and DHCP. Setting DNS forward IP to local for captive portal setup

Map framework

Copy the server framework files across

some popup mehods

  1. place javascript files and map tiles into /var/www

MQ var directory archive

Remember to make all /var/www/ folders readable with:

sudo find /var/www -type d -exec chmod a+x {} +

and possibly

sudo find /var/www -type d -exec chown  {} root:root +

For Map content

MapNik coding platform for maps... pull render tiles using this? beautiful Stamen Design map that can be used

Map example1.png
Map example2.png