Homestead
这是一篇协同翻译的文章,你可以点击『我来翻译』按钮来参与翻译。
Laravel Homestead
介绍
Laravel 致力于让整个 PHP 开发体验变得愉快,其中也包括你的本地开发环境。Laravel Homestead 是一个官方预打包的 Vagrant box,它为你提供了一个极佳的开发环境,而无需在本地机器上安装 PHP、Web 服务器或任何其他服务器软件。
Vagrant 提供了一种简单、优雅的方式来管理和配置虚拟机。Vagrant box 完全是一次性的。如果出现问题,你可以在几分钟内销毁并重新创建这个 box!
Homestead 可以运行在任何 Windows、macOS 或 Linux 系统上,并且包含 Nginx、PHP、MySQL、PostgreSQL、Redis、Memcached、Node 以及开发出色 Laravel 应用所需的所有其他软件。
[!警告]
如果你使用的是 Windows,可能需要启用硬件虚拟化(VT-x)。这通常可以通过 BIOS 启用。如果你在 UEFI 系统上使用 Hyper-V,则可能还需要禁用 Hyper-V 才能访问 VT-x。
Included Software
- Ubuntu 22.04
- Git
- PHP 8.3
- PHP 8.2
- PHP 8.1
- PHP 8.0
- PHP 7.4
- PHP 7.3
- PHP 7.2
- PHP 7.1
- PHP 7.0
- PHP 5.6
- Nginx
- MySQL 8.0
- lmm
- Sqlite3
- PostgreSQL 15
- Composer
- Docker
- Node (With Yarn, Bower, Grunt, and Gulp)
- Redis
- Memcached
- Beanstalkd
- Mailpit
- avahi
- ngrok
- Xdebug
- XHProf / Tideways / XHGui
- wp-cli
可选软件
- Apache
- Blackfire
- Cassandra
- Chronograf
- CouchDB
- Crystal & Lucky Framework
- Elasticsearch
- EventStoreDB
- Flyway
- Gearman
- Go
- Grafana
- InfluxDB
- Logstash
- MariaDB
- Meilisearch
- MinIO
- MongoDB
- Neo4j
- Oh My Zsh
- Open Resty
- PM2
- Python
- R
- RabbitMQ
- Rust
- RVM (Ruby Version Manager)
- Solr
- TimescaleDB
- Trader (PHP extension)
- Webdriver & Laravel Dusk Utilities
安装与设置
第一步
在启动你的 Homestead 环境之前,你必须先安装 Vagrant,以及以下受支持的提供商之一:
这些软件包都为所有流行的操作系统提供了易于使用的可视化安装程序。
要使用 Parallels provider,你需要安装 Parallels Vagrant 插件。它是免费的。
安装 Homestead
你可以通过将 Homestead 仓库克隆到主机上来安装 Homestead。建议将仓库克隆到你的 用户目录(home 目录)下的 Homestead
文件夹中,因为 Homestead 虚拟机会作为你所有 Laravel 应用的宿主环境。在本文档中,我们会将这个目录称为 Homestead 目录:
git clone https://github.com/laravel/homestead.git ~/Homestead
克隆完 Laravel Homestead 仓库后,你需要切换到 release
分支。这个分支始终包含 Homestead 的最新稳定版本:
cd ~/Homestead
git checkout release
接下来,在 Homestead 目录中执行 bash init.sh
命令来创建 Homestead.yaml
配置文件。Homestead.yaml
文件是你配置 Homestead 安装的地方。该文件会被放置在 Homestead 目录下:
# macOS / Linux...
bash init.sh
# Windows...
init.bat
配置 Homestead
设置 Provider
Homestead.yaml
文件中的 provider
键表示应该使用哪个 Vagrant provider:virtualbox
或 parallels
:
provider: virtualbox
[!警告]
如果你使用的是 Apple Silicon,则必须使用 Parallels provider。
配置共享文件夹
Homestead.yaml
文件中的 folders
属性列出了你希望与 Homestead 环境共享的所有文件夹。 当这些文件夹中的文件发生变化时,它们会在本地机器和 Homestead 虚拟环境之间保持同步。你可以根据需要配置任意多个共享文件夹:
folders:
- map: ~/code/project1
to: /home/vagrant/project1
[!警告]
Windows 用户不应该使用~/
路径语法,而应当使用项目的完整路径,例如:
C:\Users\user\Code\project1
你应该始终将每个应用程序单独映射到它自己的文件夹,而不是把包含所有应用的大目录一次性映射进去。
当你映射一个文件夹时,虚拟机必须追踪该文件夹内 每一个文件 的磁盘 IO。
如果文件夹中文件数量庞大,可能会导致性能下降:
folders:
- map: ~/code/project1
to: /home/vagrant/project1
- map: ~/code/project2
to: /home/vagrant/project2
[!警告]
使用 Homestead 时,绝对不要挂载.
(当前目录)。
这样会导致 Vagrant 不会把当前目录映射到/vagrant
,从而破坏可选功能,并在配置时产生意外结果。
要启用 NFS,你可以在文件夹映射中添加一个 type
选项:
folders:
- map: ~/code/project1
to: /home/vagrant/project1
type: "nfs"
[!警告]
在 Windows 上使用 NFS 时,建议安装 vagrant-winnfsd 插件。
这个插件会确保 Homestead 虚拟机中的文件和目录保持正确的用户/组权限。
你还可以通过在 options
键下列出配置,传递 Vagrant 的 Synced Folders 所支持的任意选项:
folders:
- map: ~/code/project1
to: /home/vagrant/project1
type: "rsync"
options:
rsync__args: ["--verbose", "--archive", "--delete", "-zz"]
rsync__exclude: ["node_modules"]
配置 Nginx 站点
对 Nginx 不熟悉?没关系。
Homestead.yaml
文件中的 sites
属性允许你轻松地将一个“域名”映射到 Homestead 环境中的某个文件夹。
Homestead.yaml
文件中已经包含了一个示例站点配置。
同样地,你可以根据需要在 Homestead 环境中添加任意数量的站点。
Homestead 可以作为一个方便的虚拟化环境,为你正在开发的每个 Laravel 应用提供服务:
sites:
- map: homestead.test
to: /home/vagrant/project1/public
如果你在配置 Homestead 虚拟机之后更改了 sites
属性,你应该在终端中执行 vagrant reload --provision
命令来更新虚拟机上的 Nginx 配置。
[!警告]
Homestead 脚本被构建为尽可能幂等。然而,如果你在配置时遇到问题,你应该通过执行vagrant destroy && vagrant up
命令来销毁并重建虚拟机。
主机名解析
Homestead 使用 mDNS
发布主机名以进行自动主机解析。
如果你在 Homestead.yaml
文件中设置 hostname: homestead
,该主机将在 homestead.local
可用。
macOS、iOS 和 Linux 桌面发行版默认包含 mDNS
支持。
如果你使用 Windows,你必须安装 Bonjour Print Services for Windows。
使用自动主机名在 按项目安装 Homestead 时效果最好。
如果你在单个 Homestead 实例上托管多个站点,你可以将网站的“域名”添加到你机器的 hosts
文件中。
hosts
文件会将对你的 Homestead 站点的请求重定向到你的 Homestead 虚拟机。
-
在 macOS 和 Linux 上,这个文件位于
/etc/hosts
。 -
在 Windows 上,这个文件位于
C:\Windows\System32\drivers\etc\hosts
。
你添加到这个文件的行看起来像这样:
192.168.56.56 homestead.test
确保所列出的 IP 地址是你在 Homestead.yaml
文件中设置的那个。
一旦你将域名添加到 hosts
文件并启动 Vagrant box,你将能够通过浏览器访问该站点:
http://homestead.test
配置服务
Homestead 默认启动若干服务;然而,你可以在配置(provisioning)期间自定义哪些服务被启用或禁用。例如,你可以通过修改 Homestead.yaml
文件中的 services
选项来启用 PostgreSQL 并禁用 MySQL:
services:
- enabled:
- "postgresql"
- disabled:
- "mysql"
指定的服务将根据它们在 enabled
和 disabled
指令中的顺序被启动或停止。
启动 Vagrant Box
一旦你按自己的喜好编辑了 Homestead.yaml
,在你的 Homestead 目录中运行 vagrant up
命令。Vagrant 将启动虚拟机并自动配置你的共享文件夹和 Nginx 站点。
要销毁该机器,你可以使用 vagrant destroy
命令。
按项目安装
你可以选择不在全局安装 Homestead 并在所有项目之间共享相同的 Homestead 虚拟机,而是为你管理的每个项目配置一个 Homestead 实例。如果你希望随项目一起发布 Vagrantfile
,以便其他协作者在克隆项目仓库后能够立即运行 vagrant up
,则按项目安装 Homestead 可能更有益。
你可以使用 Composer 包管理器将 Homestead 安装到你的项目中:
composer require laravel/homestead --dev
一旦 Homestead 被安装,调用 Homestead 的 make
命令为你的项目生成 Vagrantfile
和 Homestead.yaml
文件。这些文件将被放置在你的项目根目录。make
命令会自动在 Homestead.yaml
文件中配置 sites
和 folders
指令:
# macOS / Linux...
php vendor/bin/homestead make
# Windows...
vendor\\bin\\homestead make
接下来,在终端中运行 vagrant up
命令,并在浏览器中通过 http://homestead.test
访问你的项目。
请记住,如果你没有使用自动的 主机名解析,仍然需要在 /etc/hosts
文件中添加 homestead.test
或你选择的域名条目。
安装可选功能(Installing Optional Features)
可选软件可以通过 Homestead.yaml
文件中的 features
选项进行安装。
大多数功能可以通过布尔值开启或关闭,而某些功能允许配置多个选项:
features:
- blackfire:
server_id: "server_id"
server_token: "server_value"
client_id: "client_id"
client_token: "client_value"
- cassandra: true
- chronograf: true
- couchdb: true
- crystal: true
- dragonflydb: true
- elasticsearch:
version: 7.9.0
- eventstore: true
version: 21.2.0
- flyway: true
- gearman: true
- golang: true
- grafana: true
- influxdb: true
- logstash: true
- mariadb: true
- meilisearch: true
- minio: true
- mongodb: true
- neo4j: true
- ohmyzsh: true
- openresty: true
- pm2: true
- python: true
- r-base: true
- rabbitmq: true
- rustc: true
- rvm: true
- solr: true
- timescaledb: true
- trader: true
- webdriver: true
Elasticsearch
你可以指定 Elasticsearch 的支持版本,必须使用完整版本号(主版本.次版本.修订号)。
默认安装会创建一个名为 homestead
的集群。
请注意,Elasticsearch 不应使用操作系统超过一半的内存,因此确保 Homestead 虚拟机至少有 Elasticsearch 分配内存的两倍。
[!注意]
请参考 Elasticsearch 文档 了解如何自定义配置。
MariaDB
启用 MariaDB 将移除 MySQL 并安装 MariaDB。MariaDB 通常可作为 MySQL 的直接替代品,因此在应用的数据库配置中仍应使用 mysql
数据库驱动。
MongoDB
默认的 MongoDB 安装会将数据库用户名设置为 homestead
,对应密码为 secret
.
Neo4j
默认的 Neo4j 安装会将数据库用户名设置为 homestead
,对应密码为 secret
。要访问 Neo4j 浏览器,请通过网页浏览器访问 http://homestead.test:7474
。端口 7687
(Bolt), 7474
(HTTP), 和 7473
(HTTPS) 已准备就绪,可处理来自 Neo4j 客户端的请求。
别名
您可以通过修改 Homestead 目录中的 aliases
文件来为 Homestead 虚拟机添加 Bash 别名:
alias c='clear'
alias ..='cd ..'
更新 aliases
文件后,应使用 vagrant reload --provision
命令重新配置 Homestead 虚拟机。这将确保新别名在虚拟机上可用。
更新 Homestead
在开始更新 Homestead 之前,应确保已通过以下命令移除当前虚拟机(在 Homestead 目录中执行):
vagrant destroy
接下来,需要更新 Homestead 源代码。如果您克隆了仓库,可以在最初克隆仓库的位置执行以下命令:
git fetch
git pull origin release
这些命令将从 GitHub 仓库拉取最新的 Homestead 代码,获取最新标签,然后检出最新的标签版本。您可以在 Homestead 的 GitHub 发布页面上找到最新的稳定发布版本。
如果您通过项目的 composer.json
文件安装了 Homestead,应确保 composer.json
文件中包含 "laravel/homestead": "^12"
并更新依赖项:
composer update
接下来,应使用 vagrant box update
命令更新 Vagrant 盒子:
vagrant box update
更新 Vagrant 盒子后,应在 Homestead 目录中运行 bash init.sh
命令以更新 Homestead 的附加配置文件。系统将询问您是否要覆盖现有的 Homestead.yaml
, after.sh
, 和 aliases
文件:
# macOS / Linux...
bash init.sh
# Windows...
init.bat
最后,需要重新生成 Homestead 虚拟机以使用最新的 Vagrant 安装:
vagrant up
日常使用
通过 SSH 连接
您可以在 Homestead 目录中执行 vagrant ssh
终端命令来 SSH 连接到虚拟机。
添加额外站点
Homestead 环境配置并运行后,您可能希望为其他 Laravel 项目添加额外的 Nginx 站点。您可以在单个 Homestead 环境中运行任意数量的 Laravel 项目。要添加额外站点,请将站点添加到 Homestead.yaml
文件中。
sites:
- map: homestead.test
to: /home/vagrant/project1/public
- map: another.test
to: /home/vagrant/project2/public
[!警告]
在添加站点之前,应确保已为项目目录配置了 文件夹映射 。
如果 Vagrant 没有自动管理您的 "hosts" 文件,您可能还需要将新站点添加到该文件中。在 macOS 和 Linux 上,该文件位于 /etc/hosts
。在 Windows 上,位于 C:\Windows\System32\drivers\etc\hosts
:
192.168.56.56 homestead.test
192.168.56.56 another.test
添加站点后,在 Homestead 目录中执行 vagrant reload --provision
终端命令。
站点类型
Homestead 支持多种站点"类型",便于运行非 Laravel 项目。例如,我们可以使用 statamic
站点类型轻松将 Statamic 应用添加到 Homestead:
sites:
- map: statamic.test
to: /home/vagrant/my-symfony-project/web
type: "statamic"
可用的站点类型包括: apache
, apache-proxy
, apigility
, expressive
, laravel
(默认), proxy
用于 nginx), silverstripe
, statamic
, symfony2
, symfony4
, 和 zf
。
站点参数
您可以通过 fastcgi_param
站点指令为站点添加额外的 Nginx params
值:
sites:
- map: homestead.test
to: /home/vagrant/project1/public
params:
- key: FOO
value: BAR
环境变量
您可以通过在 Homestead.yaml
文件中添加全局环境变量:
variables:
- key: APP_ENV
value: local
- key: FOO
value: bar
更新 Homestead.yaml
文件后,务必通过执行 vagrant reload --provision
命令重新配置虚拟机。这将更新所有已安装 PHP 版本的 PHP-FPM 配置,同时更新 vagrant
用户的环境。
Ports
默认情况下,以下端口会转发到您的 Homestead 环境:
- HTTP: 8000 → 转发到 80
- HTTPS: 44300 → 转发到 443
转发额外端口
如需将额外端口转发到 Vagrant 盒子,可以在 ports
文件中定义 Homestead.yaml
配置项。更新 Homestead.yaml
文件后,务必通过执行 vagrant reload --provision
命令重新配置虚拟机:
ports:
- send: 50000
to: 5000
- send: 7777
to: 777
protocol: udp
以下列出了您可能希望从主机映射到 Vagrant 盒子的其他 Homestead 服务端口:
- SSH: 2222 → 到 22
- ngrok UI: 4040 → 到 4040
- MySQL: 33060 → 到 3306
- PostgreSQL: 54320 → 到 5432
- MongoDB: 27017 → 到 27017
- Mailpit: 8025 → 到 8025
- Minio: 9600 → 到 9600
PHP 版本
Homestead 支持在同一虚拟机上运行多个 PHP 版本。您可以在 Homestead.yaml
文件中为指定站点设置要使用的 PHP 版本。可用的 PHP 版本包括: "5.6", "7.0", "7.1", "7.2", "7.3", "7.4", "8.0", "8.1", "8.2", 和 "8.3", (默认版本):
sites:
- map: homestead.test
to: /home/vagrant/project1/public
php: "7.1"
在 Homestead 虚拟机内, 您可以通过 CLI 使用任何受支持的 PHP 版本:
php5.6 artisan list
php7.0 artisan list
php7.1 artisan list
php7.2 artisan list
php7.3 artisan list
php7.4 artisan list
php8.0 artisan list
php8.1 artisan list
php8.2 artisan list
php8.3 artisan list
您可以通过在 Homestead 虚拟机内执行以下命令来更改 CLI 使用的默认 PHP 版本:
php56
php70
php71
php72
php73
php74
php80
php81
php82
php83
连接数据库
系统已为 MySQL 和 PostgreSQL 配置了 homestead
数据库。要从主机的数据库客户端连接到 MySQL 或 PostgreSQL 数据库,应连接到 127.0.0.1
的 33060
端口(MySQL)或 54320
端口(PostgreSQL)。两个数据库的用户名和密码均为 homestead
/ secret
.
[!警告]
仅当从主机连接数据库时才应使用这些非标准端口。在 Laravel 应用的database
配置文件中,您将使用默认的 3306 和 5432 端口,因为 Laravel 运行在虚拟机内部。
Database Backups
Homestead can automatically backup your database when your Homestead virtual machine is destroyed. To utilize this feature, you must be using Vagrant 2.1.0 or greater. Or, if you are using an older version of Vagrant, you must install the vagrant-triggers
plug-in. To enable automatic database backups, add the following line to your Homestead.yaml
file:
backup: true
Once configured, Homestead will export your databases to .backup/mysql_backup
and .backup/postgres_backup
directories when the vagrant destroy
command is executed. These directories can be found in the folder where you installed Homestead or in the root of your project if you are using the per project installation method.
Configuring Cron Schedules
Laravel provides a convenient way to schedule cron jobs by scheduling a single schedule:run
Artisan command to run every minute. The schedule:run
command will examine the job schedule defined in your routes/console.php
file to determine which scheduled tasks to run.
If you would like the schedule:run
command to be run for a Homestead site, you may set the schedule
option to true
when defining the site:
sites:
- map: homestead.test
to: /home/vagrant/project1/public
schedule: true
The cron job for the site will be defined in the /etc/cron.d
directory of the Homestead virtual machine.
Configuring Mailpit
Mailpit allows you to intercept your outgoing email and examine it without actually sending the mail to its recipients. To get started, update your application's .env
file to use the following mail settings:
MAIL_MAILER=smtp
MAIL_HOST=localhost
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
Once Mailpit has been configured, you may access the Mailpit dashboard at http://localhost:8025
.
Configuring Minio
Minio is an open source object storage server with an Amazon S3 compatible API. To install Minio, update your Homestead.yaml
file with the following configuration option in the features section:
minio: true
By default, Minio is available on port 9600. You may access the Minio control panel by visiting http://localhost:9600
. The default access key is homestead
, while the default secret key is secretkey
. When accessing Minio, you should always use region us-east-1
.
In order to use Minio, ensure your .env
file has the following options:
AWS_USE_PATH_STYLE_ENDPOINT=true
AWS_ENDPOINT=http://localhost:9600
AWS_ACCESS_KEY_ID=homestead
AWS_SECRET_ACCESS_KEY=secretkey
AWS_DEFAULT_REGION=us-east-1
To provision Minio powered "S3" buckets, add a buckets
directive to your Homestead.yaml
file. After defining your buckets, you should execute the vagrant reload --provision
command in your terminal:
buckets:
- name: your-bucket
policy: public
- name: your-private-bucket
policy: none
Supported policy
values include: none
, download
, upload
, and public
.
Laravel Dusk
In order to run Laravel Dusk tests within Homestead, you should enable the webdriver feature in your Homestead configuration:
features:
- webdriver: true
After enabling the webdriver
feature, you should execute the vagrant reload --provision
command in your terminal.
Sharing Your Environment
Sometimes you may wish to share what you're currently working on with coworkers or a client. Vagrant has built-in support for this via the vagrant share
command; however, this will not work if you have multiple sites configured in your Homestead.yaml
file.
To solve this problem, Homestead includes its own share
command. To get started, SSH into your Homestead virtual machine via vagrant ssh
and execute the share homestead.test
command. This command will share the homestead.test
site from your Homestead.yaml
configuration file. You may substitute any of your other configured sites for homestead.test
:
share homestead.test
After running the command, you will see an Ngrok screen appear which contains the activity log and the publicly accessible URLs for the shared site. If you would like to specify a custom region, subdomain, or other Ngrok runtime option, you may add them to your share
command:
share homestead.test -region=eu -subdomain=laravel
If you need to share content over HTTPS rather than HTTP, using the sshare
command instead of share
will enable you to do so.
[!WARNING]
Remember, Vagrant is inherently insecure and you are exposing your virtual machine to the Internet when running theshare
command.
Debugging and Profiling
Debugging Web Requests With Xdebug
Homestead includes support for step debugging using Xdebug. For example, you can access a page in your browser and PHP will connect to your IDE to allow inspection and modification of the running code.
By default, Xdebug is already running and ready to accept connections. If you need to enable Xdebug on the CLI, execute the sudo phpenmod xdebug
command within your Homestead virtual machine. Next, follow your IDE's instructions to enable debugging. Finally, configure your browser to trigger Xdebug with an extension or bookmarklet.
[!WARNING]
Xdebug causes PHP to run significantly slower. To disable Xdebug, runsudo phpdismod xdebug
within your Homestead virtual machine and restart the FPM service.
Autostarting Xdebug
When debugging functional tests that make requests to the web server, it is easier to autostart debugging rather than modifying tests to pass through a custom header or cookie to trigger debugging. To force Xdebug to start automatically, modify the /etc/php/7.x/fpm/conf.d/20-xdebug.ini
file inside your Homestead virtual machine and add the following configuration:
; If Homestead.yaml contains a different subnet for the IP address, this address may be different...
xdebug.client_host = 192.168.10.1
xdebug.mode = debug
xdebug.start_with_request = yes
Debugging CLI Applications
To debug a PHP CLI application, use the xphp
shell alias inside your Homestead virtual machine:
xphp /path/to/script
Profiling Applications With Blackfire
Blackfire is a service for profiling web requests and CLI applications. It offers an interactive user interface which displays profile data in call-graphs and timelines. It is built for use in development, staging, and production, with no overhead for end users. In addition, Blackfire provides performance, quality, and security checks on code and php.ini
configuration settings.
The Blackfire Player is an open-source Web Crawling, Web Testing, and Web Scraping application which can work jointly with Blackfire in order to script profiling scenarios.
To enable Blackfire, use the "features" setting in your Homestead configuration file:
features:
- blackfire:
server_id: "server_id"
server_token: "server_value"
client_id: "client_id"
client_token: "client_value"
Blackfire server credentials and client credentials require a Blackfire account. Blackfire offers various options to profile an application, including a CLI tool and browser extension. Please review the Blackfire documentation for more details.
Network Interfaces
The networks
property of the Homestead.yaml
file configures network interfaces for your Homestead virtual machine. You may configure as many interfaces as necessary:
networks:
- type: "private_network"
ip: "192.168.10.20"
To enable a bridged interface, configure a bridge
setting for the network and change the network type to public_network
:
networks:
- type: "public_network"
ip: "192.168.10.20"
bridge: "en1: Wi-Fi (AirPort)"
To enable DHCP, just remove the ip
option from your configuration:
networks:
- type: "public_network"
bridge: "en1: Wi-Fi (AirPort)"
To update what device the network is using, you may add a dev
option to the network's configuration. The default dev
value is eth0
:
networks:
- type: "public_network"
ip: "192.168.10.20"
bridge: "en1: Wi-Fi (AirPort)"
dev: "enp2s0"
Extending Homestead
You may extend Homestead using the after.sh
script in the root of your Homestead directory. Within this file, you may add any shell commands that are necessary to properly configure and customize your virtual machine.
When customizing Homestead, Ubuntu may ask you if you would like to keep a package's original configuration or overwrite it with a new configuration file. To avoid this, you should use the following command when installing packages in order to avoid overwriting any configuration previously written by Homestead:
sudo apt-get -y \
-o Dpkg::Options::="--force-confdef" \
-o Dpkg::Options::="--force-confold" \
install package-name
User Customizations
When using Homestead with your team, you may want to tweak Homestead to better fit your personal development style. To accomplish this, you may create a user-customizations.sh
file in the root of your Homestead directory (the same directory containing your Homestead.yaml
file). Within this file, you may make any customization you would like; however, the user-customizations.sh
should not be version controlled.
Provider Specific Settings
VirtualBox
natdnshostresolver
By default, Homestead configures the natdnshostresolver
setting to on
. This allows Homestead to use your host operating system's DNS settings. If you would like to override this behavior, add the following configuration options to your Homestead.yaml
file:
provider: virtualbox
natdnshostresolver: 'off'
本文中的所有译文仅用于学习和交流目的,转载请务必注明文章译者、出处、和本文链接
我们的翻译工作遵照 CC 协议,如果我们的工作有侵犯到您的权益,请及时联系我们。
推荐文章: