我正在尝试configurationlighttpd,以便为我的Ruby on Rails应用程序提供静态文档,并将请求路由到我的Ruby on Rails应用程序服务器。
这是迄今为止的configuration:
$HTTP["host"] =~ "(^|www\.)brlafreniere.com$" { proxy-core.protocol = "http" proxy-core.balancer = "hash" proxy-core.backends = ( "127.0.0.1:5000", "127.0.0.1:5001", "127.0.0.1:5002", ) server.document-root = "/var/www/brlafreniere.com/public" }
有了这个configuration,击中brlafreniere.com在我的浏览器结果404找不到。
我做了curl127.0.0.1:5000并收到了我的Ruby on Rails应用程序的头版预期的响应。
我正在使用以下脚本来启动应用程序服务器。
#!/bin/bash RAILS_ENV=production rake assets:clobber assets:precompile puma --pidfile /tmp/brlafreniere.com.1 --environment production --port 5000 > log/puma.log 2>&1 & puma --pidfile /tmp/brlafreniere.com.2 --environment production --port 5001 > log/puma.log 2>&1 & puma --pidfile /tmp/brlafreniere.com.3 --environment production --port 5002 > log/puma.log 2>&1 &
有没有办法我可以调整这个来获得更多的日志输出? 日志输出不是很有帮助。 🙂
看起来好像我需要使用代理模块而不是代理内核。
我还通过设置http://assets.brlafreniere.com将Rails设置为在config/environments/production.rb通过config.action_controller.asset_host来引用资源,并在我的lightyconfiguration文件中设置一个指令,捕获$HTTP["host"] == "assets.brlafreniere.com" ,然后相应地设置server.document-root,现在一切正常。