Laravel configuration with apache

Posted September 22, 2015 59.4k views

Please help me with laravel configuration for making it work with apache

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers

You should be able to install a Laravel app just like any other website. See How To Set Up Apache Virtual Hosts on Ubuntu 14.04 LTS.

You’ll need to install a couple of PHP extensions that Laravel needs:

sudo apt-get install php5-mcrypt php5-json
sudo php5enmod mcrypt
sudo php5enmod json
sudo service apache2 restart

The rewrite module should be enabled by default, but if your routes aren’t working properly, try enabling it:

sudo a2enmod rewrite
sudo service apache2 restart

Finally, you need to grant Laravel write permissions to the app/storage directory:

sudo chown -R www-data:www-data /var/www/
by Justin Ellingwood
The Apache web server is the most popular way to serve web content on the internet. Apache has the ability to serve multiple domains from a single server by using a mechanism called "virtual hosts". If a virtual host is configured correctly for each domain, the web server can correctly route traffic to the appropriate files based on the domain name requested. In this guide, we'll demonstrate how to configure Apache virtual hosts on an Ubuntu 14.04 VPS.

For users of the Ubuntu LAMP 1-Click droplets, to this I would also add something I figured out the hard way:
Often Laravel setups will have the app located in something like /var/www/laravelapp with the public folder at /var/www/laravelapp/public
The Laravel documentation points out the need to edit your apache2 sites-enabled configuration to change the DocumentRoot to /var/www/laravelapp/public

You must also change the <Directory> for the .htaccess rules to match! Otherwise even after you enabled mod_rewrite, your .htaccess in /var/www/laravelapp/public will be ignored, and nothing but your home page will load.