acloudtree

Cakephp + Ubuntu 8.04 + Apache2 Mod_rewrite

This tutorial assumes that you installed the basic LAMP stack that ubuntu comes with. It is also assumed that this is a development installation of CakePHP

1) Download CakePHP. My directory after I uncompress it is called ‘cake_1.2.1.8004′

*optional
2) Rename ‘cake_1.2.1.8004′ to ‘cake’

3) Move the ‘cake’ directory into ‘/var/www/’ so your full path becomes ‘/var/www/cake/’

4) Enable mod_rewrite

username@ubuntu:/$ sudo a2enmod rewrite
Enabling module rewrite.
Run '/etc/init.d/apache2 restart' to activate new configuration!

5) Enable appropriate rules in ‘/etc/apache2/sites-available/default’

username@ubuntu:/$ sudo vi /etc/apache2/sites-available/default

5a) Change the following

Directory /
Options FollowSymLinks
AllowOverride None
/Directory

To


Directory /
Options FollowSymLinks
AllowOverride All
Directory

5b) Change the following

Directory /var/www/
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
Directory

To


Directory /var/www/
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
/Directory

6) Restart apache2

username@ubuntu:/$ sudo /etc/init.d/apache2 restart

default screenshot

5 comments

  1. MrAn3 says:

    Thx, it was very helpful for me, a newbie in linux, but it worked without changing the
    “Directory /” part.

  2. CalamityJane says:

    Hi,

    I tried it, but it didn’t work. I had Cake up and running before, but upgraded my machine to kubuntu 9.04 and now I am desperately trying to make it work. I get either an 403 or an 500 error.
    Any idea what else I could try?
    mod rewrite is loaded and works in general, but not for my application, which is located at /var/www/budget <- that is my application

    Jane

  3. Jane,

    There are so many variables that there is no easy answer.

    Could you post the contents of your ‘/etc/apache2/sites-available/’ directory?

    Also, are you running virtual hosts?

  4. CalamityJane says:

    foo@foo:/etc/apache2/sites-available$ ls -l
    insgesamt 28
    -rw-r–r– 1 root root 984 2010-02-20 23:07 default
    -rw-r–r– 1 root root 985 2010-02-20 23:07 default~
    -rw-r–r– 1 root root 1001 2010-02-20 22:46 default.cake
    -rw-r–r– 1 root root 1001 2010-02-20 22:55 default.orig
    -rw-r–r– 1 root root 7364 2009-08-18 15:01 default-ssl
    -rw-r–r– 1 root root 1008 2010-02-20 15:32 default.typo3

    foo@foo:/etc/apache2/sites-enabled$ ls -lA
    insgesamt 0
    lrwxrwxrwx 1 root root 26 2009-11-10 23:38 000-default -> ../sites-available/default

    I don’t run virtual hosts ist is just my PC which I use for development

    Thanks Jane

  5. CalamityJane says:

    Sorry should have mentioned that I use ubuntu 9.10
    Jane

Post a comment

Copyright © Jared Folkins
Programming, Computers, Writing, Economics, and Life

Powered by WordPress