If, for some reason, you ever want to use Laravel’s Homestead with Apache instead of Nginx, there are a few commands you’ll need to run.
First, you’ll probably want to get rid of Nginx itself.
sudo apt-get remove nginx
sudo apt-get purge nginx
Next, install Apache. Make sure to update the latest packages from the repositories, too.
sudo apt-get update
sudo apt-get install apache2
Once you have installed Apache, configure your conf files (in /etc/apache2/sites-available/site.conf
) to point to the correct directory.
Next, you’ll have to edit your Vagrantfile
to include the following line within the Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
block:
config.vm.synced_folder "/path/to/app", "/home/vagrant/projects/app", :owner => "www-data", :group => "www-data", :mount_options => ["dmode=775", "fmode=664"]
where /path/to/app
is your local folder and /home/vagrant/projects/app
is the remote path on the virtual machine.
This is important if you’re manipulating files (creating, deleting) as it will run the web server as www-data
rather than the default vagrant
, and prevent you running into permissions issues.
Next, make sure PHP is installed and Apache uses it by running sudo apt-get install php5
. Once that has completed, turn on the mod_rewrite module with a2enmod rewrite
, restart Apache with service apache2 restart
, and fire up your website.
The post Use Laravel Homestead with Apache Instead of Nginx appeared first on Mobius Media.