问题
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.
回答1:
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
来源:https://stackoverflow.com/questions/25378673/cakephp-does-not-work-in-ubuntu-14-04