我在许多项目中使用 Vagrant 盒子,在此之前我没有遇到任何问题。为了帮助我的文档工作人员,我使用 Vagrant 设置了 MkDocs,一切正常,直到我想从主机浏览。
我使用scotch/box 3.5 免费版,Python 2.7.12
我已经安装pip 18.1
并开始了sudo mkdocs serve
。我知道它正在工作,因为我可以curl http://127.0.0.1:8000
但是当我浏览主机http://192.168.33.10:8000/
时返回
This site can’t be reached 192.168.33.10 refused to connect.
Search Google for 192 168 8000
ERR_CONNECTION_REFUSED
浏览http://192.168.33.10
将返回Scotch IO 盒子 /public/index.php
我还尝试关闭盒子的 apache 服务器,但这也无济于事。有人看到我的设置有什么问题吗?
流浪文件
Vagrant.configure("2") do |config|
# /*=====================================
# = FREE VERSION! =
# =====================================*/
# This is the free (still awesome) version of Scotch Box.
# Please go Pro to support the project and get more features.
# Check out https://box.scotch.io to learn more. Thanks
config.vm.box = "scotch/box"
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.network "forwarded_port", guest: 8000, host: 8000
config.vm.hostname = "scotchbox"
config.vm.synced_folder ".", "/var/www", :mount_options => ["dmode=777", "fmode=666"]
# Optional NFS. Make sure to remove other synced_folder line too
#config.vm.synced_folder ".", "/var/www", :nfs => { :mount_options => ["dmode=777","fmode=666"] }
config.vm.provision "shell", path: "deploy.sh"
end
deploy.sh #!/usr/bin/env bash
apt-get update
apt-get install -y python-pip
pip install mkdocs
更新
我可以看到MkDocs
正在运行并检测到源文件的更改。
服务器在盒子上运行。