我正在尝试在Scotch Box虚拟机上设置CouchDB(并最终使用PouchDB)。VM运行良好,通过包含以下代码,包括端口5849的端口转发:
Vagrant.configure("2") do |config|
config.vm.box = "scotch/box-pro"
config.vm.hostname = "scotchbox"
config.vm.network "forwarded_port", guest: 80, host: 8080
config.vm.network "forwarded_port", guest: 5984, host: 5984
config.vm.network "forwarded_port", guest: 3000, host: 3000
config.vm.network "private_network", ip: "192.168.33.10"
虚拟机运行良好。如果运行节点服务器,则localhost:8080将加载PHP主页,localhost:3000将加载节点脚本,但localhost:5984仅在使用curl从浏览器或主机命令行加载时返回空响应
curl: (52) Empty reply from server
.
vagrant ssh
要访问虚拟机,我可以使用
curl localhost:5984
获得
{"couchdb":"Welcome","uuid":"9cabeb8f66947adabe9443594aa7f69c","version":"1.6.0","vendor":{"version":"15.10","name":"Ubuntu"}}
正如所料。
以下是我所指的指南:
https://pouchdb.com/guides/setup-couchdb.html
其他信息:当我转到192.168.33.10:5984(而不是使用本地主机端口转发)时,结果是连接被拒绝。
谢谢