2017-01-12 54 views
1

我有一个主文件夹,我在多个项目中使用不同的语言工作。我用这个盒子是https://github.com/fideloper/Vaprobash流浪箱内的多台服务器

我目前正在对在后端使用仙丹与4000端口,然后在端口上运行的前端节点服务器3000

我的问题是如何做一个项目我同时运行两台服务器?

我使用Apache虚拟主机访问例如特定项目:projectname.192.168.22.10.nip.io:3000

回答

1

设置多个端口转发您的Vagrantfile:

Vagrant.configure("2") do |config| 
 
    config.vm.network "forwarded_port", guest: 3000, host: 12003, protocol: "tcp" 
 
    config.vm.network "forwarded_port", guest: 4000, host: 12004, protocol: "tcp" 
 
end
添加自动更正如果你不确定主机端口:

auto_correct: true
然后创建主机(其中无业游民核心)上的反向代理与像上行流:

projectname.local will redirect to http://localhost:12003 
 
projectname-back.local wil redirect to http://localhost:12004

使用nginx的的反向代理,它非常简单的设置:)