Why laravel homestead is not running Apache
- Laravel homestead is currently able to install apache using your Homestead.yaml file.
Add a key to your sites called type
. Set it to apache
. like so:
sites:
- map: laravel.local
to: "/home/vagrant/laravel"
type: apache
Make sure you don't mix up apache and nginx, that won't work.
Then run vagrant up
and to install apache and provision the right config files.
If it doesn't work, then first make sure to update to the latest version of homestead.
Here is an interesting article on the matter: https://www.nginx.com/blog/nginx-vs-apache-our-view/. TLDR: Nginx is faster.
Only when you have an existing project and you really need to use apache. Or in case your application is going to run on an apache server. Starting fresh? Use nginx.
Steps are as follows here.
SSH into vagrant ->
vagrant ssh
Stop Nginx ->
sudo service nginx stop
Remove it ->
sudo apt-get purge nginx
Update you repos ->
sudo apt-get update
Install apache ->
sudo apt-get install apache2
Restart it ->
sudo service apache2 restart
You are now on Apache server, update the apache conf file as your needs.
What exactly are you trying to do and perhaps we can supply a solution to your problem. You shouldn't really need to be rewriting URLs with .htaccess as Laravel's routing handles this.
1) Regardless of software, if you're needing to configure the webserver for each specific project, its probably better to go and configure your own vagrant box that is relevant for that project.
2) Nginx outperforms apache and reduces a lot of the bloat that simply isn't needed. Its also what forge uses and so homestead uses in turn so its mocking the forge environment.
3) See point 1, configure your own vagrant box for this project.