2011年9月6日 星期二

BusyBox hpptd 說明


1. Enable Busybox httpd
        Networking Utilities=>[*] httpd
2.mkdir /www /www/cgi-bin
3.touch /etc/httpd.conf
4.run httpd => httpd -h /www/ -c /etc/httpd.conf
5.CGI程式:有二種方式,一個是用shell script,另一種是用c語言
    5.1 shell script
        存到/www/cgi-bin/cgi-test1
#!/bin/sh
echo "Content-type: text/html"
echo ""
echo "<HTML><HEAD><TITLE>test</TITLE></HEAD>"
echo "<BODY>"
echo "<pre>"
ls
echo ""
echo "</pre>"
echo "</BODY></HTML>"
5.2 c language
#include <stdio.h>
main() 
{
printf("Content-type:text/html\n\n");
printf("Hello,World!");

build成執行檔後將執行檔copy至/www/cgi-bin/cgi-test2
6.用瀏覽器執行該二個cgi即可

沒有留言:

張貼留言