版本:
- 流明:5.2
- 流浪者:1.8.1
- 宅基地:最新
我刚刚安装了 Homestead,并试图用它来开发 Lumen 应用程序。Lumen 应用在 MAMP 上非常快(正如预期的那样),但在 Homestead 上却非常慢。虽然我预计在使用 VM 时性能会下降,但我遇到的性能下降实际上是导致 Homestead 无法使用。
我在 OS X Yosemite 上,拥有 16GB 的 RAM 和 8 个逻辑核心。我也在使用 VirtualBox 来运行我的虚拟机。
宅基地.yaml
---
ip: "192.168.10.10"
memory: 4096
cpus: 2
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/repos
to: /home/vagrant/Code
type: nfs
sites:
- map: my-site.app
to: /home/vagrant/Code/my-site/public
databases:
- homestead
在我的 nginx 配置中:
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index /index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors off;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
}
虽然通过 PHPUnit 运行我的测试套件非常快(在 Homestead 和我的本地文件系统中运行),但浏览器中的响应却非常缓慢。例如,一个简单的路由返回hello world
需要 5 - 10 秒的响应时间。
我可以做些什么来增加响应时间?还有其他可以优化的设置吗?