开发者

CakePHP rookie question, The requested URL /pages/andy was not found on this server

I am installing CakePHP for the first time, I am running LAMP on Ubuntu 10.04LTS. Not only am I a CakePHP rookie, I am a Linux rookie as well. I found installation instructions online and I thought i had everything setu开发者_StackOverflowp correctly. When i go to localhost i get the default CakePHP page and everything is green.

The problem is when i created a generic page called andy.ctp in the /var/www/app/views/pages folder, when i try to go to localhost/pages/andy I get a 404 NOT FOUND page that says "The requested URL /pages/andy was not found on this server."

I am sure i missed something on the initial setup, i just cant find out what. I have Googled the error and have yet to find anything to get me along. Below is my default file. Please let me know if there is anything else you need to see. Thanks for the help in advance!

is there something in the .htaccess file that might need to be changed?

<VirtualHost *:80>
ServerAdmin webmaster@localhost

DocumentRoot /var/www/app/webroot
<Directory />
    Options FollowSymLinks
    AllowOverride All
</Directory>
<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
</Directory>

ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.log combined

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
    Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>


Let's try a few things first:

  1. Do you have the whole CakePHP package installed under one same directory. I say so because I saw you have /var/www/app, and the cake directory must also be within /var/www/. Even when you have these directories allright, I recommend that you set the whole CakePHP package into another subdirectory, like /var/www/your_project/app. This will enable you to add more projects easily as time go. Also, you might want to set the Document Root to a home-level directory (i.e. /home/your_name/www/your_project so that you can handle file permissions more easy.

  2. Do you have mod_rewrite enabled? It is required by Cake. Do a Google search; there are plenty of tutorials.

Let me know if any of these work.


Followup:

Hello again.

If you are seeing the default CakePHP start page with all green notices (see this old screenshot), then it means that you dont have anything wrong with mod_rewrite or htaccess. However, I reproduced the steps you took along with your virtualhost configuration file and found two issues:

1) You are pointing the DocumentRoot to /var/www/app/webroot when it should point to the top-level directory, in this case /var/www/ (i.e. the directory where CakePHP's topmost index.php is). Also, be sure to have this directive: DirectoryIndex index.php

2) You are not closing the <VirtualHost> tag; though this can actually be a wrong copy+paste here in S.O.

Overall, try to 'debug' your VirtualHost file by starting with just a few lines so that you have to worry less about misconfigurations. I use these few for any project in my local machine, and I've had multiple CakePHP Projects all running under Apache for Ubuntu.

<VirtualHost dummysite.com:80>
ServerName dummysite.com
ServerAdmin myemail@gmail.com
DocumentRoot "/home/yamir/Programming/Projects/dummysite"
DirectoryIndex index.php
LogLevel warn
ErrorLog "/home/yamir/Programming/Projects/dummysite/logs/error.log"
CustomLog "/home/yamir/Programming/Projects/dummysite/logs/access.log" combined
</VirtualHost>


Have you definitely turned on mod_rewrite?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜