Jump to content
xisto Community
Sign in to follow this  
paolocastro

Cakephp On Ubuntu using your own public_html folder

Recommended Posts

Hi, there are many tutorials about this, but i would like to type the steps i followed in order to get cakephp working on my user public_html folder.
as many of you probably know, if you have apache's userdir module loaded, you can put your web pages on /home/user/public_html , and access them with the url: LOCALHOST/~user/ . I really prefer this, so all my web pages are on my personal home, but how to configure cakephp to work with these paths, i got a hard time with this, but finally got it!. here's how:

in case you don't have apache2's userdir module:

sudo ln -s /etc/apache2/mods-available/userdir.load /etc/apache2/mods-enabled/userdir.loadsudo ln -s /etc/apache2/mods-available/userdir.conf /etc/apache2/mods-enabled/userdir.conf

you need the rewrite module also... (this could be done with the same method used for userdir)
sudo a2enmod rewrite

Now lets edit some apache files...
sudo vim /etc/apache2/sites-enable/000-default
inside the first two <directory></directory> tags, change the AllowOverride lines:
<Directory />				Options FollowSymLinks				AllowOverride All	  // change here		</Directory>		<Directory /var/www/>				Options Indexes FollowSymLinks MultiViews				AllowOverride All		 // change here				Order allow,deny				allow from all				# This directive allows us to have apache2's default start page				# in /apache2-default/, but still have / go to the right place				#RedirectMatch ^/$ /apache2-default/		</Directory>
do the same on /etc/apache2/mods-enabled/userdir.conf
<Directory /home/*/public_html>				AllowOverride All		// change here				Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec		</Directory>

Now you need to restart you apache2 server...
sudo /etc/init.d/apache2 restart

i'll assume you've already downloaded cakephp latest release or that you know where you can find it

unpack the downloaded file in /home/user/public_html/
rename the extracted folder (thats the name of your application)
cd /home/user/public_html/application_name
edit the .htaccess file so it look like these:
<IfModule mod_rewrite.c>   RewriteEngine on   RewriteRule	^$ app/webroot/	[L]   RewriteRule	(.*) app/webroot/$1 [L]   RewriteBase  /~user/application_name/</IfModule>

now point your browser to LOCALHOST/~user/application_name and you show see cakephp's default page
good luck!

Share this post


Link to post
Share on other sites
ThanksCakephp On Ubuntu

Thank you so much! I have been having the hardest time getting my URLs to work and I realize that I never did an "AllowOveride ALL" for my files. What a relief!

-reply by NeilMonday

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.