This is the Android port of "Simple HTTP server sample for sanos" from http://www.jbox.dk/sanos/webserver.htm written by Michael Ringgaard.

Porting to Android by Iulian Virtejanu, 2011. Android patch also distributed as BSD License,  please read the LICENSE file.

Root is required on your Android phone.

Change log:
v1.0 21 Aug 2011
   Initial port to Android
v1.1 23 Aug 2011
   Added command line options
   Added listing of all local ips (helps a lot to find out the WiFi IP)
   Added Basic HTTP authentication for security 

Running:

a) adb push webserver /sdcard/
b) adb shell
c) su
d) cd /system/bin
e) cp /sdcard/webserver .
f) chmod 755 webserver
g) ./webserver -u <username> -p <password> -s <port>

Now browse to your phone's IP on the given port.
Since most mobile carriers block incoming traffic, you won't probably be able to access your phone via GSM/3G data connection, only over WiFi. If you still want to access your phone remotely even when connected to GSM/3G data only, a much more advanced configuration is needed: http://hex.ro/wp/blog/administer-your-android-phone-from-internet-root-needed/.
There are other software alternatives to access your phone remotely but they also use 3rd party servers which are maintained by their producers.

To stop:

a) open a different terminal
b) ps | grep webserver
c) kill <pid_of_webserver>

To compile:

a) you need to have a build system which is able to generate native ARM code. For starting, please check this web site: http://betelco.blogspot.com/2010/01/buildingdebugging-android-native-c.html
b) download webserver.c from here: http://www.jbox.dk/sanos/webserver.htm
c) apply the included patch.
d) build it.

That's it!