我正在尝试使用Vagrant在Windows 10主机上使用Virtual Box设置Ubuntu / Apache虚拟机,然后配置主机,以便magento.dev
在浏览器中打开URL会在虚拟机上打开一个页面。
这是我的Vagrant文件中的相关配置
Vagrant.configure("2") do |config|
config.vm.network "private_network", ip: 192.168.10.10
config.vm.hostname = "magento.dev"
我加了线
192.168.10.10 magento.dev
到hosts
Windows 10主机中的文件。
在配置了Vagrant机器之后,我.htaccess
从html目录中删除了该文件,以确保它没有执行引起该问题的意外操作。
我可以打开浏览器并转到http://192.168.10.10
Windows主机,然后显示虚拟机的网页。
我可以ping magento.dev
从Windows主机上获取,并且ping显示IP地址192.168.10.10
并返回响应。
但是,如果magento.dev
在浏览器中转到,则会出现“ ERR_CONNECTION_REFUSED”错误。还要注意,URL更改为https
,而http://192.168.10.10
URL并未更改为https
。
192.168.10.10
通过Windows主机上的Web浏览器进行访问时,我可以看到Apache访问日志已更新。当我magento.dev
在浏览器中转到时,Apache访问日志不会更新。因此,Apache必须忽略我的Web请求或不接收它,但是我不知道为什么,因为我的Windowshosts
文件应该将这些请求定向到192.168.10.10,我可以使用进行验证ping magento.dev
。
如何进行设置,以便magento.dev
在主机上返回虚拟机上的网页?
对不起,我以前的回答很显然,我在回答之前没有阅读您的问题。这次我做了,幸运的是我知道了实际的答案:)
.dev是Google拥有的注册TLD(顶级域)。Chrome 63+和Firefox 59+将强制所有以.dev(和.foo)结尾的域通过预加载的HTTP Strict Transport Security(HSTS)标头重定向到HTTPS。
这是whois数据:
$ whois .dev
% IANA WHOIS server
% for more information on IANA, visit http://www.iana.org
% This query returned 1 object
domain: DEV
organisation: Charleston Road Registry Inc.
address: 1600 Amphitheatre Parkway
address: Mountain View, CA 94043
address: United States
contact: administrative
name: Domains Policy and Compliance
organisation: Google Inc.
address: 601 N. 34th Street
address: Seattle, WA 98103
address: United States
phone: 1 202 642 2325
fax-no: 1 650 492 5631
e-mail: [email protected]
contact: technical
name: Richard Roberto
organisation: Google Inc.
address: 76 9th Avenue, 4th Floor
address: New York, NY 10011
address: United States
phone: 1 212 565 2633
fax-no: 1 650 492 5631
e-mail: [email protected]
nserver: NS-TLD1.CHARLESTONROADREGISTRY.COM 2001:4860:4802:32:0:0:0:69 216.239.32.105
nserver: NS-TLD2.CHARLESTONROADREGISTRY.COM 2001:4860:4802:34:0:0:0:69 216.239.34.105
nserver: NS-TLD3.CHARLESTONROADREGISTRY.COM 2001:4860:4802:36:0:0:0:69 216.239.36.105
nserver: NS-TLD4.CHARLESTONROADREGISTRY.COM 2001:4860:4802:38:0:0:0:69 216.239.38.105
nserver: NS-TLD5.CHARLESTONROADREGISTRY.COM 2001:4860:4805:0:0:0:0:69 216.239.60.105
ds-rdata: 60074 8 2 b942e2ce5aebf62fca59d05707e6dbb795211d540d8adba02e9e89e833424785
whois: whois.nic.google
status: ACTIVE
remarks: Registration information: http://www.registry.google
created: 2014-11-20
changed: 2018-06-09
source: IANA
这是铬源中的相关位:https : //chromium.googlesource.com/chromium/src.git/+/63.0.3239.118/net/http/transport_security_state_static.json#255
// eTLDs
// At the moment, this only includes Google-owned gTLDs,
// but other gTLDs and eTLDs are welcome to preload if they are interested.
{ "name": "google", "include_subdomains": true, "mode": "force-https", "pins": "google" },
{ "name": "dev", "include_subdomains": true, "mode": "force-https" },
{ "name": "foo", "include_subdomains": true, "mode": "force-https" },
{ "name": "page", "include_subdomains": true, "mode": "force-https" },
{ "name": "app", "include_subdomains": true, "mode": "force-https" },
{ "name": "chrome", "include_subdomains": true, "mode": "force-https" },
我建议您使用其他后缀。我倾向于为我的一个域使用实际的DNS记录,但是.test后缀也可以使用。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句