我正在使用Micro-Framework Lumen并让它与Vagrant一起运行。
所以简单地说:当我使用localhost:8000(默认选项)调用网站时它运行但当我尝试使用Nginx在示例URL myawesomewebsite.com 下调用它时它会返回白页。
到目前为止我尝试了什么:
- >从Windows配置了hosts file
(添加了带有URL地址的随机IP),例如:55.55.55.5 myawesomewebsite.com
- >配置了homestead.yaml
- >已安装(当然)Nginx
vagrant
计算机并启动它
Homestead.yaml
---
ip: "55.55.55.5"
memory: 2048
cpus: 1
provider: virtualbox
sites:
- map: myawesomewebsite.com
to: /home/vagrant/Code/project/public
主持人
55.55.55.5 myawesomewebsite.com
答案 0 :(得分:2)
您不能使用随机IP,您需要使用为private network保留的IP,有3个可用范围
| RFC1918 name | IP address range | number of addresses | largest CIDR block (subnet mask) |
|--------------|-------------------------------|---------------------|----------------------------------|
| 24-bit block | 10.0.0.0 - 10.255.255.255 | 16,777,216 | 10.0.0.0/8 (255.0.0.0) |
| 20-bit block | 172.16.0.0 - 172.31.255.255 | 1,048,576 | 172.16.0.0/12 (255.240.0.0) |
| 16-bit block | 192.168.0.0 - 192.168.255.255 | 65,536 | 192.168.0.0/16 (255.255.0.0) |
我通常更喜欢使用192.168.0.0/16范围,例如在Homestead.yaml文件中
---
ip: "192.168.90.51"
memory: 2048
cpus: 1
provider: virtualbox
sites:
- map: myawesomewebsite.localdomain
to: /home/vagrant/Code/project/public
和您的Windows主机
192.168.90.51 myawesomewebsite.localdomain