简体   繁体   English

禁止403-Rails应用

[英]Forbidden 403 - Rails App

Some help would be appreciated - keep getting Forbidden 403 error. 一些帮助将不胜感激-不断收到禁止403错误。 Nginx configuration: Nginx配置:

listen       80;
server_name  www.xxx.com;   
passenger_enabled   on;
#charset koi8-r;
#access_log  logs/host.access.log  main;
root   /home/deploy/xxx.com/current;

I've deployed with Capistrano, and it was successful (cap deploy) I've googled and not found much help, from those that I tried. 我已经在Capistrano上进行了部署,并且通过谷歌搜索(但没有找到太多帮助)对我进行了尝试,这是成功的(盖帽部署)。 Secondly, I've removed my "public" folder, and enabled my "route" in routes.rb. 其次,我删除了“ public”文件夹,并在routes.rb中启用了“ route”。

root to: 'static_pages#home'

Origionally I had the "public" folder in place, but it kept going to "index.html", not the Rails /Home. 最初,我有“ public”文件夹,但是它一直转到“ index.html”,而不是Rails / Home。 I've tried this locally and it works perfectly with "rails server" on localhost:3000. 我在本地尝试过,它与localhost:3000上的“ rails服务器”完美配合。

It almost appears as if NGINX does not now how to find or serve up the Rails pages. 似乎NGINX现在不再如何查找或提供Rails页面。

Ps. 附言 I did review StackOverflow, not luck there. 我确实检查了StackOverflow,但还没有碰到运气。

Any help would be appreciated. 任何帮助,将不胜感激。

与该错误相关的原因有多种,请查看此帖子以获取更多详细信息: http : //thelazylog.com/posts/how-to-fix-403-fobidden-issue-on-nginx-rails-application

Yihhaaaaa ok got it! Yihhaaaaa知道了!

The problem seemed to be two things as mentioned in the comments: 问题似乎是评论中提到的两件事:

(a) Pre-compilation error; (a)编译前错误; "images" were not loading. “图像”未加载。 Went into 进去
config/environments/production.db and turned on "true" for asset compilation. config / environments / production.db并打开“ true”进行资产编译。

(b) Second thing was because I was developing on Mac OS X, a Javascript Runtime is included by default, whereas my production Ubuntu not so. (b)第二件事是因为我在Mac OS X上进行开发,因此默认情况下包括Javascript Runtime,而我的产品Ubuntu则没有。 So I added to GemFile - gem "therubyracer". 因此,我在GemFile中添加了-gem“ therubyracer”。

And what do you know it works! 您知道它有效吗! The key was looking in the production.log (/home/deploy/xxx.com/current/log/). 关键是查看production.log(/home/deploy/xxx.com/current/log/)。 That shall tell all. 那将告诉所有人。

Cheers 干杯

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM