CakePHP Installation Broke (Probably Apache2 Problem)
I tried to install CakePHP on my home Ubuntu 10.04 desktop for development/testing purposes, and I believe I have gone through all the appropriate steps. However, I am still running into the problem that my layout is broken. I believe this is a DocumentRoot or mod_rewrite problem, but I don't have enough experience in Apache to diagnose and fix it.
/var/www/cakephp/.htaccess
1 <IfModule mod_rewrite.c>
2 RewriteEngine on
3 RewriteRule ^$ app/webroot/ [L]
4 RewriteRule (.*) app/webroot/$1 [L]
5 </IfModule>
/var/www/cakephp/app/webroot/.htaccess
1 <IfModule mod_rewrite.c>
2 RewriteEngine On
3 RewriteCond %{REQUEST_FILENAME} !-d
4 RewriteCond %{REQUEST_FILENAME} !-f
5 RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
6 </IfModule>
Firebug gives this: 404 Not Found
Not Found
The requested URL /cakephp/css/cake.generic.css was not found on this server.
开发者_运维知识库Apache/2.2.14 (Ubuntu) Server at localhost Port 80
I tried setting the permissions of css/ and cake.generic.css to 775. owner is www-data, which is right. tmp is writable too
I also can't access the directory from my browser, 404.
but that will change your default website doccument starting point for your localhost site. if you add more sites to apache2, you'll have errors.
you might want to save your 000-default as a separate file
/etc/apache2/sites-available/cakephptesting
and configure that file with the proper docroot
and then edit your host file
/etc/hosts
and add an entry as
127.0.0.1 cakephptesting
that will allow you to access the site in a browser at http://cakephptesting
I found the solution. I had to go under /etc/apache2/sites-enabled/000-default and change DocumentRoot to /var/www/cakephp/app/webroot
Now everything loads fine. Thanks!
Sorry,
Signed,
The Apache2 Noob :)
精彩评论