如何使用Nginx服务器在同一系统上运行具有不同ruby / rails版本的2个项目

时间:2019-03-04 04:53:10

标签: ruby nginx amazon-ec2 ruby-on-rails-5 rvm

我有 有两个不同版本的ruby和rails的Rails项目,
我正在使用Nginx服务器在生产环境中运行这些项目。
我正在使用Rvm维护不同版本的ruby / rails。
我的nginx.conf是:

server {
    listen 80;
    listen [::]:80 ipv6only=on;

    server_name ec2-34-222-63-71.us-west-2.compute.amazonaws.com;

    # Tell Nginx and Passenger where your app's 'public' directory is
    root /home/ec2-user/apps/tukatech_garmentstore_live/public;

    # Turn on Passenger
    rails_env    production;
    passenger_enabled on;
    passenger_ruby /home/ec2-user/.rvm/gems/ruby-2.3.8@5.0.2/wrappers/ruby;

        # redirect server error pages to the static page /50x.html
        error_page   500 502 503 504  /50x.html;

        location = /50x.html {
            root   html;
        }
    location ~ /.well-known {
                allow all;
        }

}

对于第二个项目:

server {
    listen 3000;
listen [::]:3000 ipv6only=on;

server_name ec2-34-222-63-71.us-west-2.compute.amazonaws.com;

# Tell Nginx and Passenger where your app's 'public' directory is
root /home/ec2-user/apps/tukaweb/public;

# Turn on Passenger
rails_env    production;
passenger_enabled on;
passenger_ruby /home/ec2-user/.rvm/gems/ruby-2.4.0@rails5.1.2/bin/rails;

    # redirect server error pages to the static page /50x.html
    error_page   500 502 503 504  /50x.html;

    error_page   500 502 503 504  /50x.html;

    location = /50x.html {
        root   html;
    }
location ~ /.well-known {
            allow all;
    }

}

当我对Nginx的log.log文件进行错误操作时。

     - /home/ec2-user/.rvm/gems/ruby-2.3.8/gems/passenger-6.0.0 is not secure: it can be modified by user ec2-user
 - /home/ec2-user/.rvm/gems/ruby-2.3.8/gems is not secure: it can be modified by user ec2-user
 - /home/ec2-user/.rvm/gems/ruby-2.3.8 is not secure: it can be modified by user ec2-user
 - /home/ec2-user/.rvm/gems is not secure: it can be modified by user ec2-user
 - /home/ec2-user/.rvm is not secure: it can be modified by user ec2-user
 - /home/ec2-user is not secure: it can be modified by user ec2-user

请更正我正在做的事情,不正确的配置。预先感谢

0 个答案:

没有答案