即使没有指定,为什么 Homestead 默认运行 apache?

leo*_*zon 3 vagrant laravel homestead

我有一个 Homestead VM,其中包含多个 nginx 站点和几个 apache 站点,所有内容都通过 Homestead.yaml 文件配置(下面的简短示例):

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"
Run Code Online (Sandbox Code Playgroud)

我一直在努力打开和关闭设置type: "apache",以便虚拟机开始运行 apache (而不是 nginx),具体取决于我在特定时刻需要处理的站点。

我现在的问题是,升级Vagrant和Homestead后,它总是默认启动apache,无论是否指定,总是!所以每次启动机器时,我都需要 ssh-it 和flip服务器。

我什至尝试使用服务配置指令如下,但没有运气:

services:
    - enabled:
        - "nginx"
    - disabled:
        - "apache2"
Run Code Online (Sandbox Code Playgroud)

有什么想法吗?请帮忙!

我正在使用的版本:

Vagrant 2.2.7
Homestead 10.8.0
Run Code Online (Sandbox Code Playgroud)

小智 5

我有类似的问题。原来我需要通过SSH登录虚拟机,然后运行以下命令:

sudo systemctl enable nginx.service
Run Code Online (Sandbox Code Playgroud)

当您查看 Homestead 脚本目录中的 restart-webserver.sh 时,您会看到它会验证 nginx 是否已启用,否则它总是尝试重新启动 Apache。