问题
I'm using the Micro-Framework Lumen and let it run with Vagrant.
So simply said: it runs when I call the website with localhost:8000 (default options) but when I try to call it with Nginx under an example URL myawesomewebsite.com then it does just returns a white page.
What I tried so far:
-> configured the hosts file
from windows (added an random IP with the URL address) for instance: 55.55.55.5 myawesomewebsite.com
-> configured the homestead.yaml
-> installed (of course) Nginx
on the vagrant
machine and started it
Homestead.yaml
---
ip: "55.55.55.5"
memory: 2048
cpus: 1
provider: virtualbox
sites:
- map: myawesomewebsite.com
to: /home/vagrant/Code/project/public
hosts
55.55.55.5 myawesomewebsite.com
回答1:
You cannot take a random IP, you need to use one reserved for private network There are 3 ranges available
| 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) |
I generally prefer to use the 192.168.0.0/16 range so for example in your Homestead.yaml file
---
ip: "192.168.90.51"
memory: 2048
cpus: 1
provider: virtualbox
sites:
- map: myawesomewebsite.localdomain
to: /home/vagrant/Code/project/public
and your windows host
192.168.90.51 myawesomewebsite.localdomain
来源:https://stackoverflow.com/questions/39806311/lumen-with-nginx-returns-white-page