Skip to content

Setting Apache2 and lamp under ubuntu 13.10

Hello Everyone

I have tried to install apache2 under ubuntu 13.10 and found the following problems

first, aptitude, tasksel and gksu are not installed

simply open up a terminal and write

sudo apt-get install aptitude tasksel

then run tasksel and select lamp Server (Linux, Apache2, Php, Mysql). It’s the easiest way of installing lamp server.

I am not covering All the details of installing them, just the critical steps

Now to change the default directory of Apache2 write in console
gksu gedit /etc/apache2/sites-available/000-default.conf

It’s the same as sites-available/default under previous versions and add/change the following lines

DocumentRoot /var/www


# DocumentRoot /var/www
DocumentRoot /path/to/your/site
<Directory /path/to/your/site
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted

Save & Close the file
Please note that I have used All for AllowOverride, this enables htaccess under apache

Also note that the use of
Require All granted
instead of
Order Deny,Allow
Deny from all

is a best solution for developer machine where you can have your default directory under any file system (ntfs, fat32) and apache won’t through a 403 forbidden/not accessible error

to further enable some usefull modules of apache/htaccess run the following scripts

# this enables mod rewrite
sudo ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load

# this enables mod expires
sudo ln -s /etc/apache2/mods-available/expires.load /etc/apache2/mods-enabled/

# this enable apache headers
sudo a2enmod headers

after running all of the above commands just restart apache2 using
sudo service apache2 restart

Hopefully, this will save of a lot of times for a lot of people