On Thu, Nov 8, 2012 at 10:22 AM, V G wrote: > On Thu, Nov 8, 2012 at 3:40 AM, Electron wrote: > >> >> Howdy, >> I got a vserver running Ubuntu. >> >> I'd like to write a tiny web server for it.. but I only have experience >> in doing it >> on Windows. >> >> Could anyone possibly guide me on how to install gcc (?) and a >> minimalistic hello world >> program for Linux to interface with TPC/IP sockets? >> >> Cheers, >> Mario >> > > Two ways to go about it as follows: > > A) If you need to get a job done, and you need a very small (low CPU, > memory) and very high performance open source HTTP server, look no furthe= r > than Nginx http://nginx.org It's quickly becoming the most popular HTTP > server. Supports WSGI, FCGI, etc. Lots of modules and plugins and it's > designed well and extremely fast. > > B) If this is for educational purposes, the *right* way to do it is to us= e > an asynchronous socket and single process model (which can scale to as ma= ny > process as there are CPUs) and using IO event callbacks. In addition, on > Linux, use epoll() which is the current *correct* way to do it. There are > two very good libraries for this: libev (better than libevent), and boost > c++ libraries (very high quality, peer reviewed, open source standard > libraries for c++). Last month, I wrote a very simple hello world echo > sever using the boost c++ libraries. Here's the source code: > https://github.com/veegee/asio_server_test_1 > > Just download/git pull, and type `make`. Requires boost libraries and > libyaml. You can get rid of the libyaml requirement by hardcoding the por= t > number into main.c/main.h instead of using libyaml to read a configuratio= n > file. > On Ubuntu: Type these in order to install a build environment: # switch to your root account sudo -s # install a build environment apt-get update && apt-get upgrade -y apt-get install build-essential # install nginx if you want; apt-cache search searches for nginx packages, pick the one(s) you like and install apt-cache search nginx Again, if you want to actually run a website, use Nginx, don't code your own HTTP server, it's not easy and takes a long time to get something working. --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .