CakePHP-3.0: Can not display page properly after new installation on Ubuntu

Sometimes you are unable to view your localhost/projectName, it happens when you make a fresh install PHP, Apache2 on Ubuntu (14.04). Even you can not visit further like controllers etc. I have an experience on it.

And also its say if you visit furthers controllers that The request URL /projectName/ControllerNames was not found on this server. Apache/2.x.x (Ubuntu) Server at localhost Port 80. it looks like in the below URL

Images Like So

To resolve this I did a few things with the terminal (CTRL+T) of Ubuntu that are as follows:

First of all I checked that whether URL rewriting is properly configured on server, if not, please do below command on your terminal.

sudo a2enmod rewrite

and then restart apache server, simply doing so..

sudo service apache2 restart
or
sudo /etc/init.d/apache2 restart

If it says something like below while restarting apache2

* Restarting web server apache2
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName

To solve the above error you simply required a small configuration.

Type in Terminal

 sudo gedit /etc/apache2/apache2.conf 
and add the below things in the file

ServerName localhost

and change the webroot Directory from

Directory /var/www
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
Directory
to
Directory /var/www/html
    Options Indexes FollowSymLinks
    AllowOverride all
    Require all granted
Directory

Hope it will simply help

No Comments

Have you say: