Question

Laravel configuration with apache

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


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

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.

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/domain1.com/app/storage