konrms
6 months ago
221
6
Laravel

How to access laravel site from another computer

Posted 6 months ago by konrms

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>

Please sign in or create an account to participate in this conversation.