Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

konrms's avatar

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>
0 likes
6 replies
mcangueiro's avatar

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.

2 likes
konrms's avatar

@MCANGUEIRO - Hello MCANGUEIRO. Thanks for replying to me. I'll have a look at ngrok. I guess that's for external routing. For the LAN case I guess it's matter of setting up correctly dns service inside apache server configuration.

JamesFreeman's avatar
Level 11

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 :)

konrms's avatar

@JAMESFREEMAN - I think this is the solution "Set up their host file with 192.168.1.101 laravel.site". In the case of outside lan pc's what can I do? Port forwading from my router?

JamesFreeman's avatar

@KONRMS - Yeah, either port forward your router (I would advise against this), or set up a cheap digital ocean server, and host a staging environment.

Alternatively like @mcangueiro said above, ngork is the way forward (which will handle your port forwarding securely).

1 like
konrms's avatar

@JAMESFREEMAN - I have never tried port forwarding with my router. I will search how to. I'm not going to use it for too long, just for self learning purposes. When our project goes live we will use a dedicated server for it. For now I use xampp apache server.

Please or to participate in this conversation.