简体   繁体   English

无法评估Amazon EC2上的Rails应用

[英]cannot assess rails app on amazon ec2

I'm using Amazon EC2 and tried to deploy a rails project. 我正在使用Amazon EC2,并尝试部署Rails项目。 I have install nginx/passenger and successfully made nginx server run. 我已经安装了nginx / passenger并成功使nginx服务器运行。

I started my rails project with name "forfun" then I set the root of nginx to /home/ubuntu/rails/forfun/public 我以“ forfun”为名称启动了rails项目,然后将nginx的根目录设置为/ home / ubuntu / rails / forfun / public

I initialized a file named "index.html", then I could see the page in browser ( http://[my ip]:80) 我初始化了一个名为“ index.html”的文件,然后可以在浏览器中看到该页面( http:// [my ip]:80)

However, what i really wanna see is the welcome page of rails app. 但是,我真正想看到的是Rails应用程序的欢迎页面。

I tried do remove index.html and see what i got. 我试着删除index.html,看看我得到了什么。 I saw 404 Forbidden error. 我看到404禁止错误。 /var/log/nginx/error.log reveals that directory index of "/home/ubuntu/rails/forfun/public/" is forbidden /var/log/nginx/error.log显示禁止“ / home / ubuntu / rails / forfun / public /”的目录索引

What step i actually missed? 我实际上错过了哪一步?

by the way, do i need to do "rails server" while nginx is running? 顺便说一句,我需要在nginx运行时做“ rails服务器”吗?

ps: (1) /opt/nginx/conf/nginx.conf ps:(1)/opt/nginx/conf/nginx.conf

http {
    passenger_root /usr/local/rvm/gems/ruby-2.3.0/gems/passenger-5.0.26;
    passenger_ruby /usr/local/rvm/gems/ruby-2.3.0/wrappers/ruby;
    ... 
        server {
        listen       80;
        server_name  52.196.XX.XXX;#my amazon public ip
            root /home/ubuntu/rails/forfuni/public;
        }

(2)/etc/nginx/sites-enabled/default (2)/ etc / nginx /启用站点/默认

server {

        listen 80 default_server;
        listen [::]:80 default_server ipv6only=on;

        root /home/ubuntu/rails/forfun/public;
        index index.html index.htm;
    }

Try adding /etc/nginx/sites-enabled/default 尝试添加/ etc / nginx / sites-enabled / default

server {
 listen 80 default_server;
 server_name  52.196.XX.XXX;#my amazon public ip;

 passenger_enabled on;
 passenger_app_env development; #or whatever rails env you want.

The whole process of deploying a rails app using nginx/passenger is documented here . 本文记录使用nginx / passenger部署Rails应用程序的整个过程。 See the nginx section. 参见nginx部分。

https://www.digitalocean.com/community/tutorials/how-to-deploy-a-rails-app-with-passenger-and-nginx-on-ubuntu-14-04 https://www.digitalocean.com/community/tutorials/how-to-deploy-a-rails-app-with-passenger-and-nginx-on-ubuntu-14-04

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

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