Debian Wheezy is the recommended UNIX package for a Raspberry Pi. After setting up your device and completing the raspi-config steps, simply run the following commands line-by-line in the bash terminal to create a functioning web server.

sudo apt-get install -y build-essential make
sudo apt-get install -y mysql-server mysql-client
sudo apt-get install -y apache2
sudo apt-get install -y php5 libapache2-mod-php5

The web server root can be found at /var/www/ and will contain a default index.html file. Type the IP address of the Raspberry Pi into a web browser and a page similar to this should be presented.

Apache default index

The root web directory is owned by the Apache user so to make changes within it write and execute rights must be given to the current user. Please note that this may compromise security, so not advised for a publicly accessible server.

sudo chmod a+wx /var/www/

Now files can be created and saved in the www directory. Create a new file called info.php and type the following into it:

 <?php phpinfo(); ?>

Again, open the Raspberry Pi IP address in a web browser but this time add /info.php to the URL. If everything has been installed correctly an information screen of the PHP environment will be displayed.

PHP Info Screen

To install Node.JS on Debian Wheezy, please see this article: Install Node.JS on Debian Wheezy