Install LAMP on Ubuntu

In the last post I tell you how you can install LAMP in Ubuntu 11.10. Now I tell you how to configure virtual hosts, in this way you can create a lot of independent sites (also in different domains).

Decide where you want to store the folder that will contain the sities files. In my case, I have a very large ‘/home’ partition, I decided to put this folder in the path: ‘/home/www’.

Create the folders and set premissions:

sudo mkdir /home/www /home/www/log
sudo chmod ugo+rw /home/www /home/www/log

Now, create a new available virtual host:

sudo gedit /etc/apache2/sites-available/example

Edit this file by pasting the following code:

<VirtualHost *:80>
	ServerName example.localhost
	ServerAlias www.example.localhost
	DocumentRoot /home/www/example
	ErrorLog /home/www/log/error.log
	CustomLog /home/www/log/access.log combined

	<Directory /home/www/example>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride All
		Order allow,deny
		allow from all

Save the file and type the following commands:

mkdir /home/www/example
echo "<?php echo("index page"); ?>" > /home/www/example/index.php
sudo a2ensite example
sudo service apache2 reload

Now, you can configure your DNS to resolve the URL ‘http://example.localhost’, but is simpler to configure the ‘/etc/hosts’ in this way:

sudo gedit /etc/hosts
add the following lines: example.localhost

save the file and try to open de URL: ‘http://example.localhost’
You can see the site errors and warnings opening the file: ‘/home/www/log/error.log’

8 responses to “Install LAMP on Ubuntu

  1. Caitlyn Plowman

    Very useful! Thank you.

  2. sesli sohbet

    Heya i’m for the first time here. I found this board and I to find It truly useful & it helped me out a lot. I’m hoping to offer one thing back and aid others like you helped me

  3. sesli sohbet

    Thank you for the good writeup. It if truth be told was a leisure account it. Look advanced to more brought agreeable from you! However, how could we be in contact?

    1. Sohaib

      At work with sql files i usually use next sarowtfe-,tool is free as far as i know,it repair data from corrupted databases in the MS SQL Server format (files with the *.mdf extension),supports data extraction via the local area network,can save recovered data as SQL scripts, it is also possible to split data into files of any size,compatible with all supported versions of Microsoft Windows, such as Windows 98, Windows Me, Windows NT 4.0, Windows 2000, Windows XP, Windows XP SP2, Windows 2003 Server, Windows Vista,tool supports the following database formats: Microsoft SQL Server 7.0, 2000, 2005,also can repair .mdf files of Microsoft SQL Server 2005, repair mdf file of Microsoft SQL Server 2005 (64-bit).

    2. Hester

      That insight solves the prebolm. Thanks!

  4. John

    Please email me with some tips on how you made your website look this awesome , I would be thankful!

  5. Eliane

    great post & good information. i would like to see more of these.

Leave a Reply

Your email address will not be published.