Run Laravel application on another computer

0

Good morning, everyone. I have a Laravel application on the computer I use and would like to be able to access on another computer from the name created in Virtual Host and configured in the Hosts file of the machine I use.

Example: On computer 01 the application was created and is running by passing the name created in VirtualHost

On computer 02, on the same network, typing the address should call the application that is running computer 01.

VirtualHost file details

<VirtualHost laravel.dev:80>
    DocumentRoot "C:\xampp\htdocs\laravel\public"
    ServerAdmin laravel.dev
    <Directory "C:\xampp\htdocs\laravel">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

Hosts File Configuration

127.0.0.1      laravel.dev
    
asked by anonymous 27.10.2016 / 17:08

1 answer

0

Since both computers are on the same internal network you only need to find out what is the IP of the computer that is running the application pointing at the vhost of the machine that wants to access the application, eg

pc1 - 192.168.10.1 //pc que roda a aplicação
pc2 - 192.168.10.2 //pc que vai acessar a aplicação

Vhost of pc1

127.0.0.1    laravel.dev

Vhost of pc2

192.168.10.1    laravel.dev

Comments:

  • The settings in your apache in the <Directory "C:\xampp\htdocs\laravel"></Directory> part to release access will depend on the version of your Apache.
  • You have to ensure that the IP of the machine running the application is always the same on the network, otherwise you have to update vhost of pc2 every time ...
  • 27.10.2016 / 18:16