首页  >  文章  >  后端开发  >  nginx - php artisan serve 运行在8000 访问502报错

nginx - php artisan serve 运行在8000 访问502报错

WBOY
WBOY原创
2016-10-10 11:56:241886浏览

在虚拟机(192.168.73.130)中 运行 php artisan serve
Laravel development server started on http://localhost:8000/
访问http://192.168.73.130:8000
结果:ERR_CONNECTION_REFUSED

于是在虚拟机nginx中配置一个转发:

<code>server {
                listen 0.0.0.0:80;
                server_name lara.com;

        location / {
                proxy_set_header Host $http_host;
                proxy_set_header X-NginX-Proxy true;
                proxy_set_header X-Real-IP $remote_addr;

                proxy_pass http://localhost:8000;
                #proxy_buffering off;
                proxy_redirect on;
                }
        }
</code>

在本地浏览器中访问lara.com显示 502 Bad Gateway
在shell里面去curl http://localhost:8000/ 是会有html返回的
是我的nginx配置不对吗
求解(laravel的环境 好麻烦!!!)

回复内容:

在虚拟机(192.168.73.130)中 运行 php artisan serve
Laravel development server started on http://localhost:8000/
访问http://192.168.73.130:8000
结果:ERR_CONNECTION_REFUSED

于是在虚拟机nginx中配置一个转发:

<code>server {
                listen 0.0.0.0:80;
                server_name lara.com;

        location / {
                proxy_set_header Host $http_host;
                proxy_set_header X-NginX-Proxy true;
                proxy_set_header X-Real-IP $remote_addr;

                proxy_pass http://localhost:8000;
                #proxy_buffering off;
                proxy_redirect on;
                }
        }
</code>

在本地浏览器中访问lara.com显示 502 Bad Gateway
在shell里面去curl http://localhost:8000/ 是会有html返回的
是我的nginx配置不对吗
求解(laravel的环境 好麻烦!!!)

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn