简体   繁体   中英

Forbidden 403 - Rails App

Some help would be appreciated - keep getting Forbidden 403 error. Nginx configuration:

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. Secondly, I've removed my "public" folder, and enabled my "route" in routes.rb.

root to: 'static_pages#home'

Origionally I had the "public" folder in place, but it kept going to "index.html", not the Rails /Home. I've tried this locally and it works perfectly with "rails server" on localhost:3000.

It almost appears as if NGINX does not now how to find or serve up the Rails pages.

Ps. I did review StackOverflow, not luck there.

Any help would be appreciated.

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

Yihhaaaaa ok got it!

The problem seemed to be two things as mentioned in the comments:

(a) Pre-compilation error; "images" were not loading. Went into
config/environments/production.db and turned on "true" for asset compilation.

(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. So I added to GemFile - gem "therubyracer".

And what do you know it works! The key was looking in the production.log (/home/deploy/xxx.com/current/log/). That shall tell all.

Cheers

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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