【发布时间】:2011-11-26 21:28:04
【问题描述】:
我正在尝试在我的本地主机中安装 cakePHP。我使用 linux mint、Apache、MySQL
在 /etc/apache2 中,有文件夹 'conf.d'、'mods-available'、'mods-enabled'、'ports.conf'、'sites-available' 和 'sites-enabled'
由于我的 DocumentRoot 是 /var/www 但是,我想将 cakePHP 保留在 /home/works/ 中。 所以,
(1.) 我在 /etc/apache2/sites-enabled 中创建了一个文件名“cakephp”。
(2.) 然后,写
<VirtualHost *:80>
DocumentRoot /home/works/cakephp/app/webroot
ServerName local.ttt.cakephp
</VirtualHost>
(3.) 之后我编辑文件 /etc/hosts
127.0.0.1 localhost
127.0.0.1 local.ttt.cakephp
(4.) 试用网址:http://local.ttt.cakephp
结果:它正在工作并且 CSS 也已加载
(5.) 我尝试创建一个简单的控制器名称“测试”。 然后,试试 url:http://local.ttt.cakephp/Tests
结果:显示
Not Found
The requested URL /Tests was not found on this server.
Apache/2.2.17 (Ubuntu) Server at local.ttt.cakephp Port 80
我的解决方法:
(1.) 检查 apache2/mods-available 中的文件 rewrite.load
它有 LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so 并且没有注释 #
(2.) 将文件 apache2/sites-available/default 中的“AllowOverride None”更改为“AllowOverride All”
会是这个
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
结果:它不起作用,仍然显示“未找到”页面。
有人知道我的错误吗? 非常感谢。
【问题讨论】:
-
您应该使用 lowercase_underscore 作为 url 中的控制器和操作。但这对您的问题无关紧要。你重启 apache 了吗?
标签: cakephp