Server
sudo chown -R www-data:www-data /srv/www/example.com
sudo usermod -a -G www-data ftpuser
#directories to 755 and your files to 644... SET file permissions
#files
sudo find /srv/www/example.com -type f -exec chmod 644 {} \;
#dirs
sudo find /srv/www/example.com -type d -exec chmod 755 {} \;
sudo chown -R www-data:www-data /srv/www/example.com
#give permissions to owner and group
sudo find /srv/www/example.com -type f -exec chmod 664 {} \;
sudo find /srv/www/example.com -type d -exec chmod 775 {} \;
#cache+storage write permisions for laravel example
sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache
Create an Apache Virtual Host for your project.
laravel:~$ cd /etc/apache2/sites-available
laravel:/etc/apache2/sites-available$ sudo vi myapp.conf
Have the contents of the file match what's below.
<VirtualHost *:80>
ServerName myapp.localhost.com
DocumentRoot "/home/vagrant/projects/myapp/public"
<Directory "/home/vagrant/projects/myapp/public">
AllowOverride all
</Directory>
</VirtualHost>
Save the file, then continue below.
laravel:/etc/apache2/sites-available$ cd ../sites-enabled
laravel:/etc/apache2/sites-enabled$ sudo ln -s ../sites-available/myapp.conf
laravel:/etc/apache2/sites-enabled$ sudo service apache2 restart
Fixing Permissions
If you're running a virtual machine under Vagrant, you may want to change the user and group to avoid permission issues.
To do this:
laravel:~$ cd /etc/apache2
laravel:/etc/apache2$ sudo vi envvars
Change the lines below to contain the desired user and group
export APACHE_RUN_USER=vagrant
export APACHE_RUN_GROUP=vagrant
Save the file and restart apache.
laravel:/etc/apache2$ sudo service apache2 restart