我在多个项目中都使用了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 box的 /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
正在运行并检测到源文件的更改。
服务器在盒子上运行。