简体   繁体   中英

Access Symfony's localhost:8000 on other devices in the same network

I am developing a symfony project on my local machine, I wish to test it on my mobile via IP (both machines connected to wifi network). how do I access port 8000 (symfony's default port) on my mobile phone?

I already know about accessing localhost via IP of the serving device, but I want to access the port too(8000) which I cannot fetch from my devices!

Thanks for all the help

As answered to another Question this might be solved when adding the parameter 0.0.0.0:8000 to let Symfony not only respond to local requests but also accept requests from other devices.

The call then should look something like this:

php bin/console server:run 0.0.0.0:8000

Same way you accessing it from your local machine but using it's IP address eg:

http://192.168.1.2:8000

where 192.168.1.2 is your machine IP address in local network (check it using ipconfig command - on Windows or ifconfig on Linux/Mac OS X). Please make sure your firewalls (on local machine and on router) does not block this (8000) port.

UPD: By the way, as far as I remember, Symfony's default port is 8080, not 8000. Please check it carefully.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM