CakePp在Ubuntu 14.04中不工作 [英] CakePhp does not work in Ubuntu 14.04
问题描述
我已经安装cakephp v2.4.6在Ubuntu 14.04(64位)和数据库是PostgreSQL。同样的系统在Windows环境下工作正常,但是在我将它转移到Ubuntu后,它显示一些问题。
- CSS不工作。
某些论坛要求我们更改 /etc/apache2/sites-available/default.conf
中的配置文件。但我找不到任何 default.conf
文件。
请指导。谢谢。
很可能是htaccess / mod_rewrite的问题。
如果您访问 http://example.com/app/webroot/css,您可以看到css /my_file.css ?
启用mod_rewrite:<$ c如果是的话,这是一个mod_rewrite问题。 $ c> sudo a2enmod rewrite
/ etc / apache2 / sites-available /
。它可能是 default.conf
或 000-default.conf
,或者它可能在您的站点后命名。
您需要确保该文件中存在以下选项(注意:注意 - 您的目录可能略有不同 - 例如 / var / www / html
或其他,如果不同,请不要更改):
< Directory / var / www />
选项索引FollowSymLinks MultiViews
AllowOverride所有
订单允许,拒绝
允许所有
< / Directory>
最后,重新启动apache: sudo service apache2 restart
有关详细信息,请参阅此文章: https://www.digitalocean.com/community/tutorials/how-to-set-up-mod_rewrite
I have installed cakephp v2.4.6 in Ubuntu 14.04 (64 bit) and database is PostgreSQL. The same system works fine in Windows environment but after I transfer it into Ubuntu, it shows some issues.
- The CSS does not work. No color and the login screen alignment change.
- After login, an error says "the requested url was not found in the server" came.
Some forum ask us to change the config file in /etc/apache2/sites-available/default.conf
. But I could not find any default.conf
file.
Please guide. Thank you.
Most likely, it's an issue with htaccess / mod_rewrite.
Can you see the css if you go to http://example.com/app/webroot/css/my_file.css? If so, it's a mod_rewrite issue.
Here's some stuff to try:
Enable mod_rewrite: sudo a2enmod rewrite
There will be some relevant file in /etc/apache2/sites-available/
. It might be default.conf
, or 000-default.conf
or it might be named after your site. But there should be some relevant file there, and you'll need to edit it.
You'll need to ensure the following options are present in that file (note: be careful - your Directory may be slightly different - eg /var/www/html
or something else. If it differs, don't change it):
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
Lastly, restart apache: sudo service apache2 restart
See this article for more detail: https://www.digitalocean.com/community/tutorials/how-to-set-up-mod_rewrite
这篇关于CakePp在Ubuntu 14.04中不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!