如何使用 nginx/passenger 服务多个站点?
我有使用 Rails 构建的不同网站/应用程序,它们具有不同的域名。问题是我想通过 Nginx/passenger 从服务器为他们提供服务。我尝试了一些技术,但我无法使它们发挥作用,基本上,我对此的信息很少。
因此,我可以在不同的端口上为不同的网站/应用程序提供服务。但是,如果人们来自 aaa.com,我怎样才能让他们看到应用程序“AAA”,如果他们来自 bbb.com,我怎样才能让他们看到应用程序“BBB”呢?
I have different websites/applications built with rails, which has different domain names. The thing is I want to serve them from a server with Nginx/passenger. I tried some techniques, but I cannot make them work, basically, I have very few information about this.
So, I can serve different websites/applications on different ports. But how can I make people to see application "AAA" if they are coming from aaa.com and see application "BBB" if they are coming from bbb.com?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Phusion Passenger 的文档在第 3.2 节中对此有一段话:http://www.modrails.com/documentation/Users%20guide%20Nginx.html modrails.com/documentation/Users%20guide%20Nginx.html
基本上,您可以设置指向同一 Web 服务器/应用程序服务器对上不同应用程序的虚拟主机。
如果上述方法不起作用,您还可以纯粹通过 nginx 配置进行重写或转发。
Phusion Passenger's documentation has a passage on this here, section 3.2: http://www.modrails.com/documentation/Users%20guide%20Nginx.html
Basically, you can set up virtual hosts that point to different applications on the same web server/app server pair.
You can also do rewrites or forwarding purely through nginx configuration, if the above doesn't work.