目前我的 Ubuntu 服务器运行 RubyOnRails 应用程序和 Apache2 +Passenger。
现在我需要部署一个 Sinatra(Plain Ruby 应用程序),它需要在 Thin 而不是Passenger 上运行。
我熟悉配置 Apache,并希望以这种方式继续使用 VirtualHosts(在可用站点中)等。
如何将 Apache 中的 VirtualHost“路由”到瘦服务器?
您将把 Apache 配置为“反向代理”——该搜索词将向您指出有关配置的大量信息,但这里有一个示例,它应该可以让您在大多数情况下找到您正在寻找的部署。
如果您将使用不同的主机名和不同的<VirtualHost>
,那么您可以执行以下操作:
<VirtualHost *:80>
ServerName sinatra.example.com
# Any normal settings you use go here; access logs, ServerAdmin, etc
# Replace the 9999 below with the port that thin is using, note that it can't
# be the same as Apache's port.
# This can also be a service running on adifferent computer if you
# use another IP address instead of 127.0.0.1
ProxyPass / http://127.0.0.1:9999/
ProxyPassReverse / http://127.0.0.1:9999/
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
另一种可能对您有用的配置是将其设为现有<VirualHost>
;的子目录;您将<Location>
在现有配置中添加一个块:
<Location /sinatra/>
ProxyPass http://127.0.0.1:9999/
ProxyPassReverse http://127.0.0.1:9999/
</Location>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3594 次 |
最近记录: |