uWSGI with CGI (only requires Python)
Install using:
curl http://uwsgi.it/install | bash -s cgi /tmp/uwsgi
create a setup configuration so you can run it without too many arguments, for example test.ini
[uwsgi]
http = :8081
http-modifier1 = 9
#uid =
#gid =
check-static = ./www
static-skip-ext = .php
static-skip-ext = .rb
static-skip-ext = .py
static-skip-ext = .lua
static-index = index.html
async = 16
ugreen = true
socket = 127.0.0.1:9000
cgi = ./cgi
cgi-allowed-ext = .php
cgi-allowed-ext = .rb
cgi-allowed-ext = .py
cgi-allowed-ext = .lua
cgi-index = index.rb
create a testing script, for example ./cgi/test.rb
#!/usr/bin/env ruby
require 'cgi'
cgi = CGI.new
puts cgi.header
puts '<html><body>ENV: <ol>'
ENV.each do |k,v|
puts "<li><b>#{k}</b> #{v}</li>"
end
puts '</ol>POST: <ol>'
cgi.params.each do |k,v|
puts "<li><b>#{k}</b> #{v}</li>"
end
puts '</ol></body></html>'
start the server using:
./uwsgi test.ini
test it using browser or curl:
curl -d 'test2=2' localhost:8081/test.rb?test=1