How I set up a Hiawatha web server with Puppy

Booting, installing, newbie
Post Reply
Message
Author
CoffeaRobusta
Posts: 6
Joined: Sat 13 Jun 2009, 02:56

How I set up a Hiawatha web server with Puppy

#1 Post by CoffeaRobusta »

Hi All,

About a year ago, I found an old laptop in the trash. It was a Gateway Solo 9100 with PII processor and win98se. It was bloated and slow, so I reinstalled win98se, and was searching for open source apps, when I came across open source OS's. Anyway, long story short, I tried various linux os's on the laptop, and puppy ran the best. With Puppy 4.3.1, it's even better.

I now am able to use the laptop as a web-server, using Hiawatha. I even installed Puppeee to a flash card to run on our EeePC 900a. Love the tangogps app that's bundle with Puppeee. I even complied a program for the first time ever, by making gpsbabel as a pet package. I am just amazed at how relatively easy Puppy is. To be fair, playing around with other linux systems has helped me to become familiar with them in general, but there is good work here.

Thanks, and keep it up!

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#2 Post by Flash »

Could you give us some details about how you set up the Hiawatha web server? What you use it for, what Hiawatha configuration options you chose, those sorts of things.

looseSCREWorTWO
Posts: 812
Joined: Thu 04 Feb 2010, 13:16
Location: Australia, 1999 Toshiba laptop, 512mb RAM, no HDD, 431 Retro & 421 Retro

#3 Post by looseSCREWorTWO »

CoffeaRobusta,

Your comments about how easy it is to use Puppy Linux are exactly what I found.

When I started using Puppy last December I had absolutely no knowledge or experience of any type of Linux. I had been a DOS/Windows user in the 1980s, so I know some things like "backup up everything" because it's universal to all computer systems. I knew nothing of Linux, yet I 've been able to install Puppy Linux to 8 old computers rescued from dumpsters etc, without screwing-up any existing Windows partitions. I don't think I could have done this with any other Operating System.

What impresses me about Puppy is that it tells the user what it's doing, provides options, explains the consequences of choosing each option and where possible, gives info on how to undo changes.

Best wishes,

Steve

CoffeaRobusta
Posts: 6
Joined: Sat 13 Jun 2009, 02:56

Hiawatha setup

#4 Post by CoffeaRobusta »

Hi Flash, I can try to fulfill your request. Keep in mind that it is still a work in progress and that I am learning this web-hosting stuff as I go. I know next to nothing about web-hosting and network administration so the learning curve is steep. Some of this stuff may bedownright wrong,so I would appreciate any comments or feedback.

I basically followed the HOWTO at http://www.hiawatha-webserver.org/. I used their example config file as a template. The config files for Hiawatha are located at /etc/hiawatha.

It's probably also a good idea to have a plan in mind before you start; list your resources and what you want to do with them, what features or special concerns do you have? For example, I want to use this old laptop as a web-server. It sits behind a wireless router and my ISP provider gives me a dynamic IP. I don't care if I have to use a IP address and not a human-readable URL, but security is important. I want to serve a blog using pplog and also serve a TiddlyWiki page. I'd like the blog to be publicly accessible and the tiddlywiki accessible only on the local private network.

Binding an interface
Hiawatha is initailly set to bind to the localhost interface. You'll need to change it to serve on the www. Open the Hiawatha main configuration file, hiawatha.conf, and find the binding section. I believe the other config file, httpd.conf, is not used anymore. I figure you have three basic choices on how to set the interface:
1. to localhost (127.0.0.1) - if you want just want a page servered on the local machine. This is a good idea for development and testing.
2. to the ip for the machine on the local network (something like 192.168.1.70) - this will serve webpages on your local network. Anybody on the local network that navigates to that IP will see your webpages.
3. remove (or comment out) the interface line all together and hiawatha will bind to all available interfaces. Do this to serve pages on the www.

You can change or add ports but 80 is standard for web sites. Also note that port 443 is used for secure (https://) websites and requires some other steps. I'm not serving any pages like that so I just comment it out.

Code: Select all

# BINDING SETTINGS
# A binding is where a client can connect to.
#
Binding {
    Port = 80
    MaxRequestSize = 128
    TimeForRequest = 3,20
}

#Binding {
#    Port = 443
#    MaxRequestSize = 128
#    TimeForRequest = 3,20
#    SSLcertFile = hiawatha.pem
#}
Banning Settings
The next part was suggested as means of protecting against malicious users. The BanOn statments set number of seconds an ip will be denied is they exceed set levels. Hiawatha has a number of interesting security features; check out the HOWTO page. I'll be revisiting this section as I learn more about web security.

Code: Select all

# BANNING SETTINGS
# Deny service to clients who misbehave.
#
BanOnGarbage = 300
BanOnMaxPerIP = 60
BanOnMaxReqSize = 300
KickOnBan = yes
RebanDuringBan = yes
CGI Scripts
If you want to run any cgi scripts, you can set the extensions to be interpreted as cgi, and set the paths to the handlers executing those scripts. I think, the fast cgi section can be used to pre-load a handler, for faster response. Note that permissions and the executable have to be set properly on the files.

Code: Select all

# COMMON GATEWAY INTERFACE (CGI) SETTINGS
# These settings can be used to run CGI applications. Use the 'php-fcgi'
# tool to start PHP as a FastCGI daemon.
#
CGIextension = cgi,pl,bin
CGIhandler = /usr/bin/perl:pl
CGIhandler = /usr/bin/ssi-cgi:shtml

#FastCGIserver {
#    FastCGIid = PHP5
#    ConnectTo = 127.0.0.1:2005
#    Extension = php
#
URL Toolkit
Next is the URL Toolkit section. It can be used to perform commands based on the URL received, like denying access, redirecting, or rewriting the URL. The toolkit does this before the URL reaches hiawatha. This section will be important to folks wanting to serve cms content like joomla. See the HOWTO at hiawatha. I have it all commented out because I have no need for it yet. That and I need to learn the Regular Expressions format it uses.

Code: Select all

# URL TOOLKIT
# These URL toolkit rules are made for the Banshee PHP framework,
# which can be downloaded from: http://banshee.leisink.org/
#
# UrlToolkit {
#    ToolkitID = banshee
#    RequestURI isfile Return
#    Match ^/(favicon.ico|robots.txt|sitemap.xml)$ Return
#    Match .*\?(.*) Rewrite /index.php?$1
#    Match .* Rewrite /index.php
#}
Default and Virtual Hosts
This part defines the hosts that the webserver will be...er....serving. The first host must not be contained in {brackets} and it beomes the default host. Hiawatha suggests setting your ip as the default host and setting that to a blank html page, as hackers tend to use the ip. The next sections define virtual hosts. Normally, the virtual host's names are the domain names of the sites you want to serve. The ExcuteCGI setting allows for cgi scripts to be interpreted or not, set to no for added security. The ShowIndex setting allows directory listings.

Since I don't own any domain names, and I don't subscribe to a dynamic domain name service, I just set the default site to the public IP address. Any web files that I want the public to see are in a directory set by WebsiteRoot =. Since I also wanted webpages served on the local network only, I then created a virtual host using the ip address of the machine acting as webserver, in this case my trusty trashtop. The web files for this virtual host are in their own directory. It also has its own log files.

Code: Select all

# DEFAULT WEBSITE
# It is wise to use your IP address as the hostname of the default website
# and give it a blank webpage. By doing so, automated webscanners won't find
# your possible vulnerable website.
#
# Replace the x's with the IP given to you by your ISP.
Hostname = xx.xx.xx.xx
WebsiteRoot = /root/Web-Server
AccessLogfile = /var/log/hiawatha/main/access.log
ErrorLogfile = /var/log/hiawatha/main/error.log
StartFile = index.html
ExecuteCGI = yes
ShowIndex = yes


# VIRTUAL HOSTS
# Use a VirtualHost section to declare the websites you want to host.
#
VirtualHost {
    Hostname = 192.168.1.70
    WebsiteRoot = /root/LAN
    AccessLogfile = /var/log/hiawatha/LAN/access.log
    ErrorLogfile = /var/log/hiawatha/LAN/error.log
    StartFile = index.html
	ExecuteCGI = yes
	ShowIndex = yes
}
The Result
The whole upshot is anyone navigating to my external ip address (like 216.239.51.99) gets dropped onto my main pages, which has the pplog blog. But if they are within my home network, and navigate to the private address of the webserver (like 192.168.1.80), they get internal web pages. It seems to work but I am still testing it.

Next Steps
What to implement next?
* Set up a ddns account and a ddns updater client so that I have an external and internal domain name(or can I do this myself with BIND9?)
* Set up a virtual host with my new domain name and make the default page a blank dummy
* learn more about the security features, to ensure I my site is secure
* update to the latest hiawatha version
* Set up a cgi or php so I can save changes to tiddlywiki remotely
* play around with it some more!

Thanks!

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#5 Post by Flash »

Thank you! :D

I can see that I certainly know far less than you do about servers, web or otherwise. I don't see how your web server can work if your ISP reassigns it a new IP address every time it reboots.

By the way, are you aware of Puppy's ability to operate from a multisession CD or DVD? Everything, settings, installed programs, etc., is saved on the same CD or DVD that Puppy boots from. No need for a hard disk drive at all.
[url=http://www.murga-linux.com/puppy/viewtopic.php?t=69321][color=blue]Puppy Help 101 - an interactive tutorial for Lupu 5.25[/color][/url]

CoffeaRobusta
Posts: 6
Joined: Sat 13 Jun 2009, 02:56

#6 Post by CoffeaRobusta »

Flash wrote: I can see that I certainly know far less than you do about servers, web or otherwise. I don't see how your web server can work if your ISP reassigns it a new IP address every time it reboots.
Yeah the key there is to understand the DHCP lease cycle. Every dynamic ip address has a lease time which can be hours or days, what ever the ISP sets. As long as I don't reset my router, it seems to retain the IP for a while. But you are right,if my IP changes my server won't work. Until I modify the config file again. :)

User avatar
trapster
Posts: 2117
Joined: Mon 28 Nov 2005, 23:14
Location: Maine, USA
Contact:

#7 Post by trapster »

Look at DynDns.com for static IP address. Most newer router accomodate auto updates.
It's free!
trapster
Maine, USA

Asus eeepc 1005HA PU1X-BK
Frugal install: Slacko
Currently using full install: DebianDog

Post Reply