In this tutorial I will show you how to expose your site, this particular method will only work if you are using Homestead along side your Laravel installation, this means having set up Vagrant and the Homestead configuration.

So let's say we have a site called (as creatively named, just kidding) "laravel" with the Homestead configuration:

---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: ~/Code
      to: /home/vagrant/Code

sites:
    - map: laravel.app
      to: /home/vagrant/Code/laravel/public

databases:
    - laravel

What we can do is add an extra "site" that matches the URL we would like to expose e.g.

- map: laravel.vagrantshare.com
  to: /home/vagrant/Code/laravel/public

in doing so you do not need to add this to the hosts file as you would normally do when adding a site.

Now that we have that set up all we need to do is signup to vagrant cloud run the command: vagrant share --http 8000 --https 44300 --name laravel

--name allows us to set what the subdomain is, in this case I just used laravel so that the URL would be laravel.vagrantshare.com.

As always, this is only a temporary solution and shouldn't be used long term or in development mode.

Happy Laravel exposure,

Jamie Bonnett


Login

or Sign Up

Sign Up

or Login