laravelvagranthomestead

Why Homestead is running apache by default even if not specified?


I have a Homestead VM with multiple nginx sites and a couple of apache sites too, everything configured through the Homestead.yaml file (short example below):

sites:

- map: site1.local
  to: /home/vagrant/site1
  php: "7.1"
  #type: "apache  <= (commented on purpose, not an error)

- map: site2.local
  to: /home/vagrant/site2
  php: "7.1"

I've been working turning On and Off the type: "apache" setting so the VM starts running apache (instead of nginx) or not, depending on the site that I need to work on at the specific moment.

My Issue now is that, after upgrading Vagrant and Homestead, it always keeps starting apache by default, no matter if it is specified or not, ALWAYS!; so everytime I start the machine, I need to ssh-it and flip the server.

I even tried using the services config directive as follows, without luck:

services:
    - enabled:
        - "nginx"
    - disabled:
        - "apache2"

Any thoughts? Please help!

Versions I am using:

Vagrant 2.2.7
Homestead 10.8.0

Solution

  • I had a similar issue. It turned out that I needed to log in the VM through SSH, and run the following command:

    sudo systemctl enable nginx.service
    

    When you look at restart-webserver.sh in the Homestead scripts directory, you will see that it verifies whether nginx is enabled, otherwise it always tries to restart Apache.