Home > Backend Development > PHP Tutorial > nginx - php artisan serve runs at 8000 and accesses 502 error

nginx - php artisan serve runs at 8000 and accesses 502 error

WBOY
Release: 2016-10-10 11:56:24
Original
1935 people have browsed it

Run php artisan serve in the virtual machine (192.168.73.130)
Laravel development server started on http://localhost:8000/
Visit http://192.168.73.130:8000
Result: ERR_CONNECTION_REFUSED

So configure a forwarding in the virtual machine 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>
Copy after login
Copy after login

When accessing lara.com in the local browser, it shows 502 Bad Gateway
If you go to curl http://localhost:8000/ in the shell, there will be HTML returned
Is my nginx configuration wrong?
Please solve (Laravel’s environment is very troublesome) ! ! )

Reply content:

Run php artisan serve in the virtual machine (192.168.73.130)
Laravel development server started on http://localhost:8000/
Visit http://192.168.73.130:8000
Result: ERR_CONNECTION_REFUSED

So configure a forwarding in the virtual machine 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>
Copy after login
Copy after login

When accessing lara.com in the local browser, it shows 502 Bad Gateway
If you go to curl http://localhost:8000/ in the shell, there will be HTML returned
Is my nginx configuration wrong?
Please solve (Laravel’s environment is very troublesome) ! ! )

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template