I think one of the easiest ways of doing what you want is using ngrok (https://ngrok.com/). I'm not familiar with XAMPP, so I don't know how easy it is to implement it there. But I'm sure if you search online there are a ton of tutorials on how to setup ngrok with XAMPP.
How to access laravel site from another computer
Hello guys.
I need some help on how to access my site running on my pc from another device in case the other device belongs: (1) to the same LAN and (2) outside LAN.
I am using XAMPP Apache server. On my pc I simply browse to page laravel.site and fully access my site.
- What I have done so far and partially works for LAN case:
At cmd I ran c:\xampp\htdocs\laravel\php artisan serve --host 192.168.1.101 --port 5000, (where 192.168.1.101 is my local ip address). In this case, when browsing to 192.168.1.101:5000 from other local pc I can see my site's first page. But when clicking on site links I get a dns error. I can only indirectly access other site routes with 192.168.1.101:5000/[route]
For your info, my C:\Windows\System32\drivers\etc\hosts file line regarding laravel is:
127.0.0.1 laravel.site
and my C:\xampp\apache\conf\extra\httpd-vhosts excerpt for laravel is the following:
# VirtualHost for LARAVEL.DEV
<VirtualHost laravel.site:80>
DocumentRoot "C:\xampp\htdocs\laravel\public"
ServerAdmin laravel.site
<Directory "C:\xampp\htdocs\laravel">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
##</VirtualHost>
I have this set up in the office so that other users can get on to our developer system,
- Don't worry about running serve with a host and port, run it like you normally would through your xampp.
- Set up their host file with
192.168.1.101 laravel.site(make sure your internal IP hasn't changed) - One of the problems I have encountered is your windows firewall blocking traffic through port 80 internally, so you may have to allow xampp in your local firewall
Hope this helps :)
Please or to participate in this conversation.