Reputation: 75
I built a laravel project in my desktop folder and running it using valet on project-name.dev . How can I access it from local network ? My IP address is 192.168.1.5 ,I'm using a mac and I tried below code but It gives me a error in my project. Is there any different solution ?
php artisan serve --host 192.168.1.5 --port 80
Any help will be appreciated!!
Upvotes: 7
Views: 19330
Reputation: 189
You can do that by using --host=0.0.0.0
. By using 0.0.0.0
, you don't need to hardcode your IP address. It will automatically point to your IP address, even if it changed at some point, maybe when you connect to a different network.
So you type
php artisan serve --host=0.0.0.0 --port=80
You can now access your app using your browser or on another computer in the same network.
http://192.168.1.5:80
Upvotes: 9
Reputation: 15464
You can follow the step below
Make valet site unsecure 1st using valet unsecure sitename
Run valet share
A publicly accessible URL will be inserted into your clipboard and is ready to paste directly into your browser. That's it.
Please note
valet share does not currently support sharing sites that have been secured using the valet secure command.
https://laravel.com/docs/5.6/valet#sharing-sites
Upvotes: 10
Reputation: 468
You forgot the equals sign in your command. It should work like this:
php artisan serve --port=80 --host=192.168.1.5
To connect any of your local network devices to your mac you can type into their browser's address bar:
192.168.1.5:80
Upvotes: 16