Password protecting Rails site running on Nginx and Phusion Passenger

风格不统一 提交于 2019-11-30 18:34:15

You need to re-specify passenger_enabled in the location block.

You can let Rails handle the authentication

# application_controller.rb
before_filter :authenticate

protected

def authenticate
  authenticate_or_request_with_http_basic do |username, password|
    username == "foo" && password == "bar"
  end
end

also you should set config.serve_static_assets = true in your environment.rb (or applicaion.rb in Rails 3) so that the static assets in public go through the same filter.

Check your Nginx error log. 403 means that you got the path to your password file wrong.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!