zoukankan      html  css  js  c++  java
  • rails 项目部署中 nginx 报错及解决方法

    错误1

    1. 报403错误,是因为启动nginx的用户默认是nobody,没有对项目目录的访问权限。

    user  myName;
    worker_processes  2;

    错误2 

    2. 报404错误,是因为在nginx.conf中未配置passenger

    server {
            listen       80;
            server_name  localhost;
            passenger_enabled on;

    错误3

    3.  Missing `secret_token` and `secret_key_base` for 'production' environment, set these values in `config/secrets.yml`

    Rails 4 出于安全考虑,需要在production 的情况下 ,生成一个key,通过 web_app/config/secrets.yml 读取。由于安全方面的考虑,此key值不建议放入svn然后通过capistrano 发布。
    
    标准准做法如下:
            在服务器上 rake secret RAILS_ENV=production 生成key
            在shell中 export 到环境变量中
            secrets.yml 不用做变化。依然保持原有代码,从环境变量中读取key值
    
    production:  
            secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>  
  • 相关阅读:
    Codeforces Round #564(div2)
    714
    1471
    UVa 11134
    UVa 1152 -4 Values whose Sum is 0—[哈希表实现]
    UVa 1374
    UVA 1343
    UVa 12325
    Yet Another Number Sequence——[矩阵快速幂]
    River Hopscotch-[二分查找、贪心]
  • 原文地址:https://www.cnblogs.com/licongyu/p/5260749.html
Copyright © 2011-2022 走看看