LEDE/OpenWRT — Setting Up A Web Server

CT WiFi
LEDE/OpenWrt & IoT
Published in
2 min readMay 4, 2016

We are going to work through installing and configuring the basics of lighttpd; a lightweight web server.

SSH to your LEDE/OpenWRT device

If you are using Windows then start PuTTY and click Session on the left side, select SSH from the options, and then enter in the IP Address of your LEDE/OpenWRT box into the Host Name field.

Once you’ve done this just click on Open to start up the SSH connection.

PuTTY

If you are connecting via terminal, then just SSH to your LEDE/OpenWRT device using the following command, where 192.168.1.1 is your LEDE/OpenWRT device’s IP address.

ssh root@192.168.1.1

Installing lighthttp

Installation of the package is as simple as you would expect, simply run the following two commands:

opkg update
opkg install lighttpd

Configuration

Once the package is installed, we need to configure it. So run the following command to open the config file:

vi /etc/lighttpd/lighttpd

Now look for a line similar to the following in your config file:

server.document-root = /www/

This is where you specify the root directory of your webserver, so make any changes here that you need.

Next you might want to enable logging so that you can troubleshoot any errors. To do this we just need to uncomment (remove the #) the following line:

server.errorlog = “/var/log/lighttpd/error.log”

Finally we need to set the port your server will run on. To do this, uncomment the following line:

server.port = 8000

You can also change the port if you want it running on something else.

Start Server On Boot (Optional)

To make your server run on startup, we just need to run one command:

/etc/init.d/lighttpd enable

If you no longer want it to start on boot, then run this instead:

/etc/init.d/lighttpd disable

If you found this post helpful please let us know by clicking the ♥ below.

This blog was brought to you by Cucumber Wi-Fi. Cucumber helps you run a more efficient Wi-Fi network. Check it out here.

Cucumber Wi-Fi — control any (Wi-Fi) device from the cloud.

--

--

CT WiFi
LEDE/OpenWrt & IoT

An orchestration tool for WiFi devices — Manage your networks from a single-pane of glass.