Have currently set up my Homestead.yaml file to map two different folders to two different sites. One is for my API and one is for phpmyadmin. Here are my homestead.yaml and the hosts file.
---
ip: "192.168.10.10"
memory: 2048
cpus: 2
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: C:\Users\nikulas\Homestead\code
to: /vagrant/code
sites:
- map: dev.api.app
to: /vagrant/code/api/public
- map: dev.phpmyadmin.app
to: /vagrant/code/phpMyAdmin
databases:
- homestead
- subit
features:
- mysql: false
- mariadb: true
- postgresql: false
- ohmyzsh: false
- webdriver: false
#services:
# - enabled:
# - "postgresql@12-main"
# - disabled:
# - "postgresql@11-main"
# ports:
# - send: 50000
# to: 5000
# - send: 7777
# to: 777
# protocol: udp
hosts
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# 192.168.10.10 dev.api.app
# 192.168.10.10 dev.phpmyadmin.app
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
So for everything is mostly working. When running vagrant up and vagrant ssh I can navigate to the code directory on if I ls I have both the api and phpMyAdmin folder. I can make requests to my API in postman like this
192.168.10.10/v2/example-endpoint
The problem is if I try going to either dev.api.app or dev.phpmyadmin.app I get "This site can’t be reached" and I see no way of navigating to phpmyadmin in the browser.
In bash scripts and similar #
is for comments, your hosts are basically out commented. For your host file to register your domains correctly, this should be removed.
# 192.168.10.10 dev.api.app
# 192.168.10.10 dev.phpmyadmin.app
Should be.
192.168.10.10 dev.api.app
192.168.10.10 dev.phpmyadmin.app