3

I have developed and maintain a web application which acts as a front end for some scrips in cgi-bin which in turn call C programs on the server. The web server is Apache2, hosted both on my office Linux box for testing and on Amazon ECC for the real deployment.

My problem is that I'm off travelling, mostly without any internet connection and with only a small portable linux machine, yet I want to develop the next release of the web pages, scripts, data sets and programs. Testing static web pages is no issue but testing pages which call server-side cgi-bin scripts is always problematic, so my idea is to put a minimal http server on the portable linux box (ubuntu 14.04) which will allow the server and client to be on the same machine without any internet (and maybe with just a socket) in-between.

Of course I can and do test scripts and programs directly, but this does not exercise features such as handling top-bit set characters in $POST_DATA or setting and retrieving cookies so would inevitably result in some divergence of code-base.

So:

  1. Is this way sensible or is there a better or simpler means to do what I want?

  2. If it is sensible, what hppt server would you recommend? I thought of miniWeb but have no experience of it.

PS: I'm expert in the the (maths of the) server-side programs but have much less experience as an apache sysadmin.

Azzabi Haythem
  • 2,318
  • 7
  • 26
  • 32
James C
  • 31
  • 2

1 Answers1

0

For many things this is sufficient:

python3 -mhttp.server --cgi

Unfortunately, it's so minimal, that it doesn't support stuff like setting the HTTP Status: https://bugs.python.org/issue10487

I'm not using lighttpd because I don't want to have to write a configuration file. Another minimal server that can be used is mini-httpd:

sudo apt install mini-httpd
/usr/sbin/mini_httpd -D -p 8000 -c 'cgi-bin/*'

The -D option keeps the server in the foreground instead of daemonizing it. The -p option is the port and -c is a pattern for my cgi scripts.

I also found that the built-in webserver of busybox can handle cgi scripts just fine:

busybox httpd -p 8000 -f
josch
  • 6,716
  • 3
  • 41
  • 49