How do I install a webserver
Use case
Webservers are widely used to serve html pages with or without dynamic content. Start here for a quick introduction.
It is also a very good example service for minimal servers in a network system to illustrate connectivity and test port forwards.
This guide is for Debian (and ubuntu based systems) and we will install lighttpd, which is a lightweight webserver.
Installing
-
Log in as root
On Ubuntu, use
sudo bash
to get a command prompt as root. On Debian, usesu
and supply root password -
Run
apt-get update
Do this to update the repository list. It just solves a lot of issues before they arize.
-
Run
apt-get install lighttpd
-
Run
nano /var/www/html/index.html
and paste the following<!DOCTYPE html PUBLIC "-//IETF//DTD HTML 2.0//EN"> <HTML> <HEAD> <TITLE> A Small Hello </TITLE> </HEAD> <BODY> <H1>Hi</H1> <P>This is very minimal "hello world" HTML document.</P> </BODY> </HTML>
This createsCreate your own start page,
-
Feel awesome
Test
-
On the server, run
w3m http://localhost
This gives you text mode version of the html page you installed
-
On another machine, run
wget http://<ip address>/index.html
, whereis the address of the server This will download
index.html
. To see it, usecat index.html
-
Start your browser and go to
http://<ip address>
Remarks
HTTP is bad for privacy, use the encrypted verison instead. Let’s encrypt may help you with that.
Further reading
(to come if they are added…)