如何使用 Passenger 为 Sinatra 应用程序配置 VirtualHost?
我在 Passenger 上运行 Rails 应用程序,一切都正常工作。
我想添加一个 Sinatra 应用程序作为 Rack 应用程序与 Passenger 一起运行,但出现路由错误。
我的 VirtualHosts 文件如下所示:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.domain1.com
DocumentRoot /home/user1/vhosts/project1/public
ErrorLog /home/user1/vhosts/project1/log/httpd_error_log
CustomLog /home/user1/vhosts/project1/log/httpd_access_log combined
</VirtualHost>
<VirtualHost *:80>
ServerName www.sub.domain2.com
DocumentRoot /home/user2/vhosts/sinatra_app/lib/public
ErrorLog /home/user2/vhosts/sinatra_app/lib/log/httpd_error_log
CustomLog /home/user2/vhosts/sinatra_app/lib/log/httpd_access_log combined
</VirtualHost>
我的 Sinatra 应用程序非常简单;我有一条名为 get "/do_something" do ....
的路线,没有公共文件。它只响应一些 JSON。
我怎样才能让它执行像 www.sub.domain2.com/do_something
这样的请求
I run a Rails app on Passenger and it all works like it should.
I want to add a Sinatra app to run as a Rack application with Passenger, but I get a routing error.
My VirtualHosts File looks like:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.domain1.com
DocumentRoot /home/user1/vhosts/project1/public
ErrorLog /home/user1/vhosts/project1/log/httpd_error_log
CustomLog /home/user1/vhosts/project1/log/httpd_access_log combined
</VirtualHost>
<VirtualHost *:80>
ServerName www.sub.domain2.com
DocumentRoot /home/user2/vhosts/sinatra_app/lib/public
ErrorLog /home/user2/vhosts/sinatra_app/lib/log/httpd_error_log
CustomLog /home/user2/vhosts/sinatra_app/lib/log/httpd_access_log combined
</VirtualHost>
My Sinatra app is really simple; I have a route called get "/do_something" do ....
with no public files. it only responds with some JSON.
How can I make it do requests like www.sub.domain2.com/do_something
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来不错,权限设置正确吗?
It seems OK,are the priviledges set correctly?