Nginx的流明返回白页 [英] Lumen with Nginx returns white page

查看:103
本文介绍了Nginx的流明返回白页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用微框架流明,并使其与Vagrant一​​起运行.

I'm using the Micro-Framework Lumen and let it run with Vagrant.

简而言之:当我使用localhost:8000(默认选项)调用网站时,它就会运行,但是当我尝试使用示例URL myawesomewebsite.com 的Nginx对其进行调用时,它只会返回白页.

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:

->在Windows中配置了hosts file(在URL地址中添加了随机IP),例如:55.55.55.5 myawesomewebsite.com

-> configured the hosts file from windows (added an random IP with the URL address) for instance: 55.55.55.5 myawesomewebsite.com

->配置了homestead.yaml

->(当然)在vagrant机器上安装了Nginx并启动了它

-> installed (of course) Nginx on the vagrant machine and started it

Homestead.yaml

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

推荐答案

您不能使用随机IP,需要使用为私有网络有3个可用范围

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)     |

我通常更喜欢使用192.168.0.0/16范围,例如在您的Homestead.yaml文件中

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

和您的Windows主机

and your windows host

192.168.90.51 myawesomewebsite.localdomain

这篇关于Nginx的流明返回白页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆