Ad

Laravel 5.2 - Homestead Same Site Loading For Every Domain

- 1 answer

For whatever reason I cannot get multiple sites to work with Homestead. Every new site added, returns the same site when I visit it in the browser

I have tried every "solution" I have come across here on stack as well as on larvel.io. None of them solve the problem. Any help would be greatly appreciated.

Below are the contents of both my .yaml file and my hosts file.

Local Directory Structure:

 Root directory = WWW
 project1       = WWW/project1
 project2       = WWW/project2

Homestead.yaml:

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

 authorize: ~/.ssh/id_rsa.pub

 keys:
     - ~/.ssh/id_rsa

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

 sites:
     - map: /project1.app
       to: /home/vagrant/Code/project1/public
     - map: /project2.dev
       to: /home/vagrant/Code/project2/public

 databases:
     - project1_db
     - project2_db

 variables:
     - key: 'APP_ENV'
       value: 'local'
     - key: 'APP_DEBUG'
       value: 'true'

 # blackfire:
 #     - id: foo
 #       token: bar
 #       client-id: foo
 #       client-token: bar

 # ports:
 #     - send: 93000
 #       to: 9300
 #     - send: 7777
 #       to: 777
 #       protocol: ump

/etc/hosts file:

 ##
 # Host Database
 #
 # localhost is used to configure the loopback interface
 # when the system is booting.  Do not change this entry.
 ##
 127.0.0.1 localhost
 255.255.255.255    broadcasthost
 ::1 localhost 

 192.168.10.10 project1.app
 192.168.10.10 project2.dev

I have tried the following:

  1. vagrant provision
  2. vagrant reload --provision
  3. Destroyed box and vagrant up
  4. vagrant global-status, followed by vagrant provision vm#
  5. have also tried to map folders and sites

ex:

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

     - map: ~/WWW/project2
       to: /home/vagrant/Code/project2

 sites:
      - map: /project1.app
        to: /home/vagrant/Code/project1/public
      - map: /project2.dev
        to: /home/vagrant/Code/project2/public
Ad

Answer

Got it.

The slashes before the domain where causing the issue.

Changed this:

sites:
    - map: /project1.app
      to: /home/vagrant/Code/project1/public
    - map: /project2.dev
      to: /home/vagrant/Code/project2/public

To this:

sites:
    - map: project1.app
      to: /home/vagrant/Code/project1/public
    - map: project2.dev
      to: /home/vagrant/Code/project2/public
Ad
source: stackoverflow.com
Ad