nanoweb installation in Ubuntu 10.10

nanoweb is an HTTP (web) server written in php, and consequently runs on any platform with php. It is small and relatively simple to install and configure. Its latest version is now (Nov. 2010) two years old, so I guess we could say it is stable.

One can, as the site says,

Download, then extract it. Read INSTALL, run install-sh.

However, I chose to use the Ubuntu Software Center, to facilitate eventual removal (or updates) if and when desired.

The Ubuntu Software Center offers nanoweb pieces in four packages, whereas the authors' zip or tgz archive contains everything. It is a mystery to me why it is “better” to split nanoweb-doc and nanoweb-contrib (16.1 KB) for separate delivery. Even nanoconfig, which is optional and a potential security risk if used on a public server, is only 93.4 KB and could well be left in the bundle, with a warning to deactivate in the install file. Instead, what happens with the Canonical install is

the server and demo default site work, but neither the link to the manual nor the link to the configuration assistance work.
even though they are installed and where they should be!!

Fixes

Fixing the broken links

The way to fix the broken links (manual and nanoconfig) is fairly simple: it consists of uncommenting two lines in /etc/nanoweb/nanoweb.conf. Open a terminal (console), then type (if gedit is your text editor, otherwise substitute the name of your text editor)

sudo gedit /etc/nanoweb/nanoweb.conf

enter your superuser password.

[sudo] password for suitable:

In your editor, around line 217, uncomment (remove the leading # from)

Alias             = /manual/ /usr/share/doc/nanoweb-doc/html/
Alias             = /nanoconfig/ /usr/share/nanoweb-nanoconfig/

then save and exit. The links should now work, once one restarts one's nanoweb server.

What has apparently happened is that, because the manual is optional in the Synaptic package system, this path has been deactivated in the configuration file. nanoconfig is also optional–as it is in the authors' distribution–so its path, too is deactivated.

Restarting nanoweb

This is another problem area: nanoctl can stop the nanoweb http server, but can't start nor restart it, and nevermind executing any of the status calls! The two obvious problems with this script (located at /usr/sbin/nanoctl) are

  1. it tries to start /usr/sbin/nanoweb.php but the server has been renamed simply nanoweb without the .php!!
  2. it tries to display status information using lynx browser, whether or not it is available.

Once solved, the operations are

sudo nanoctl stop
sudo nanoctl start

or

sudo nanoctl restart

Fixing nanoctl start|restart

First, to make nanoctl capable of starting and restarting the http server,

sudo gedit /usr/sbin/nanoctl

to edit the nanoctl script to remove .php;

# SERV='/usr/sbin/nanoweb.php'
SERV='/usr/sbin/nanoweb'

save and exit.

Update Alternatively, as recommended in this bug report comment, simply add a symlink to alias the renamed file:
sudo ln -s /usr/sbin/nanoweb /usr/sbin/nanoweb.php
Note The bug report, and this here page, both refer to Ubuntu 10.10, but the problem existed with 10.04–I encountered it in an installation on another machine a few months ago but neglected to write down what I'd learned and what I'd done to fix it so DokuWiki would run on it–and possibly earlier. Lack of earlier bug reports could be due to nanoweb not being installed often from repositories (via aptitude or Synaptic).

Fixing the nanoctl status calls

To fix (the easiest way) the calls to status:

sudo apt-get install lynx

to install the lynx text-only browser. One can then execute

nanoctl status

to see whether the http server is already running. And play with web surfing in ascii/terminal mode.

sudo nanoctl start

or simply

sudo nanoctl restart

 
ubuntu/nanoweb.txt · Dernière modification: 2010/11/17 18:47 par suitable