There are many ways to do this but I’ll share the best and the a easiest way to configure Apache MySQL and PHP (LAMP) on your Ubuntu. this is for Ubuntu 11.04
1. Go to applications->accessories->terminal
2. Enter Following commands accordingly,
sudo apt-get install tasksel
sudo tasksel install lamp-server
3. Give the MySQL root password, that’s all
4. We want the default site to be /home/YourUserName/sites/. To do this, we must create a new site and then enable it in Apache2.
To create a new site:
Create a new folder called sites in /home/YourUserName
Copy the default website as a starting point.
sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/mysite
5. gksudo gedit /etc/apache2/sites-available/mysite
6. Change the DocumentRoot and Directory to point to the new location. For example replace /var/www/ it with /home/YourUserName/sites/.
Now changes should be as follows,
……..
DocumentRoot /home/YourUserName/sites
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/YourUserName/sites/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
…..
7. Change the Directory directive, replace to
sudo a2dissite default && sudo a2ensite mysite
8. Finally, we restart Apache2:
sudo /etc/init.d/apache2 restart
9. Click here http://localhost/
10. So It Works!
This is a great guide! Quick and easy.
I have a couple questions:
Why do you create the “mysite” file instead of editing the default?
Is “mysite” equivalent to http://localhost/mysite?
If this is true then do I just copy the default site to “mysite2” to create http://localhost/mysite2?
Thanks Heath,
1. its a copy of default, see we have get changed our sites directory to more manageable area.
2. no. to understand it download
phpmyadmin
Extract it in home/administrator/sites directory if you have created it
rename it as “pma”
now click here http://localhost/pma/
You can create sites like that.
I would like to exchange links with your site amilaudana.wordpress.com
Is this possible?
You can link these posts but will see trackbacks are there.
Amila,
You Sir, are a legend! Easiest setup I’ve ever done.
Thanks very much for the info.
Regards, Tom.
pleasure
Thanks Amila for a very nice post.
It will also work if you change the document root directly in the ‘default’ file and then skip the directory change part.
Hi I did everything you wrote down here. It gives me this error: “Forbidden
You don’t have permission to access /test.php on this server.
Apache/2.2.17 (Ubuntu) Server at localhost Port 80”
What could be the problem any idea?
check again permissions to the directory.