映射站点返回此站点无法访问
Mapped sites returning This site can’t be reached
目前已将我的 Homestead.yaml 文件设置为将两个不同的文件夹映射到两个不同的站点。一个用于我的 API,一个用于 phpmyadmin。这是我的 homestead.yaml 和主机文件。
---
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
主机
# 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
因此,一切正常。当 运行 vagrant up 和 vagrant ssh 我可以导航到代码目录,如果我同时拥有 api 和 phpMyAdmin 文件夹。我可以像这样
在邮递员中向我的 API 提出请求
192.168.10.10/v2/example-endpoint
问题是,如果我尝试转到 dev.api.app 或 dev.phpmyadmin.app,我会收到“无法访问此站点”,并且无法在浏览器中导航到 phpmyadmin。
在bash脚本和类似的#
中用于评论,您的主机基本上没有评论。为了让您的主机文件正确注册您的域,应该删除它。
# 192.168.10.10 dev.api.app
# 192.168.10.10 dev.phpmyadmin.app
应该是。
192.168.10.10 dev.api.app
192.168.10.10 dev.phpmyadmin.app
目前已将我的 Homestead.yaml 文件设置为将两个不同的文件夹映射到两个不同的站点。一个用于我的 API,一个用于 phpmyadmin。这是我的 homestead.yaml 和主机文件。
---
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
主机
# 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
因此,一切正常。当 运行 vagrant up 和 vagrant ssh 我可以导航到代码目录,如果我同时拥有 api 和 phpMyAdmin 文件夹。我可以像这样
在邮递员中向我的 API 提出请求192.168.10.10/v2/example-endpoint
问题是,如果我尝试转到 dev.api.app 或 dev.phpmyadmin.app,我会收到“无法访问此站点”,并且无法在浏览器中导航到 phpmyadmin。
在bash脚本和类似的#
中用于评论,您的主机基本上没有评论。为了让您的主机文件正确注册您的域,应该删除它。
# 192.168.10.10 dev.api.app
# 192.168.10.10 dev.phpmyadmin.app
应该是。
192.168.10.10 dev.api.app
192.168.10.10 dev.phpmyadmin.app