Tuesday, November 20, 2012

Setting up LAMP on Ubuntu 12.04

LAMP - Linux Apache MySQL PhP.

Most of the stuff mentioned here is inspired from :: https://help.ubuntu.com/community/ApacheMySQLPHP

first to install apache use the following:

1> sudo apt-get install apache2

restart/start apache2 services using the following command:

2>  sudo /etc/init.d/apache2 restart

This will restart apache services.

Check whether the apache2 services have started again by visiting http://localhost. You should get the message "It works!" on your browser. If it actually works, move to point 3. else:

reasons:

a. check /var/log/apache2/error.log.** where ** is the most recent(largest) value. you will get some kind of error message. Though it is self explanatory (eg. could not access some file) which means that there is a mode problem (you have to make /var/www/index.html 744).

b. error log is empty - problem with browser caching - try removing recent content (if you have tried logging into localhost many times, browser caches your page). To remove this clear your browser cache.

3> "It works!" page is located at /var/www/index.html. This is the default root hosting directory for linux. for multiple sites or your own website, you do not want to clutter your /var/www directory. Therefore it is suggested you change your default browsing directory.

How do I do that you say?

for every website , apache creates a config file in the directory
/etc/apache2/sites-available/

with the name of the website. Opening the configuration file, you will notice a xml file like this:



1 comment: