Busybox has a built-in httpd server. Just turn it on, enable CGI and authorization etc, enable remote-port in env. Start the httpd. It works!
The tricky part comes with how to configure it. A quick fix is here:
Create the user account apach in /etc/passwd:
and in /etc/group
and in /etc/shadow:
Change the ownership of /www and /etc/httpd.conf to apach:
chown apach:apach /etc/httpd.conf
chown -R apach:apach /www
By default, it will look for /etc/httpd.conf for setup information Here is a sample httpd.conf
A:172.30. #Allow address from 172.30.0.0/16
D:* # Deny from any other IP connections
/cgi-bin:wli:123456 #require user wli, password on url starting with /cgi-bin
The following is a sample CGI script. Make sure the script has executable permission.
#!/bin/sh echo "Content-type: text/plain" echo "\r\n" echo "" echo "Sample CGI Output" echo "" echo "" env echo "" echo ""
It’s that simple!
Or, take a look at more details on this openwrt page.