Nginx 启动 Nginx 成功,但是 deploy 的应用 500 Internal Server Error

arc_start · 2015年08月09日 · 最后由 huacnlee 回复于 2015年08月10日 · 7899 次阅读

500 Internal Server Error

用的是 ubuntu 14.2/ ruby 2.1.2 /rails 4.23 ,数据库迁移啊,都成功啦。应用目录是 /home/wyl/Hack 错误日志 我去了下面说的网址,给的方法是 sudo chmod g+x,o+x /Users/phusion/Sites/rack.test 但是没用嘞

2015/08/09 16:21:46 [alert] 2254#0: *14 Cannot stat '/home/wyl/Hack/config.ru': Permission denied (errno=13); This error means that the Nginx worker process (PID 2254, running as UID 65534) does not have permission to access this file. Please read this page to learn how to fix this problem: https://www.phusionpassenger.com/library/admin/nginx/troubleshooting/?a=upon-accessing-the-web-app-nginx-reports-a-permission-denied-error; Extra info, client: 127.0.0.1, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "localhost", referrer: 
"http://localhost/chats"

下面是 /opt/nginx/conf/nginx的配置

server {
       listen       80;
       server_name  localhost;
   root /home/wyl/Hack/public;
   passenger_enabled on;
   }

或许你忘记配置 secret.yml 咯……

#1 楼 @scriptfans 配置啦!我刚刚给文件夹权限,现在已经能推送上去了!但是 bootstrap 样式完全没有了!能问问怎么回事嘛?

assets 的问题,也需要在 nginx 的配置文件里面指定一下你需要 serve 的文件目录:

location ~* ^/assets/ {
    # Per RFC2616 - 1 year maximum expiry
    expires 1y;
    add_header Cache-Control public;

    # Some browsers still send conditional-GET requests if there's a
    # Last-Modified header or an ETag header even if they haven't
    # reached the expiry date sent in the Expires header.
    add_header Last-Modified "";
    add_header ETag "";
    break;
  }

关键词 Permission denied,别的排版太乱了看不下去。

#4 楼 @rei …我知道错了,以后会注意!

#3 楼 @scriptfans 没办法显示呢,Cache COntroller 是我的应用目录嘛?下面那两个“”引号放空是嘛?谢谢回答~~

#6 楼 @arc_start 你可以随便设置的,看看 nginx 的文档就行了。主要是这句:location ~* ^/assets/

#6 楼 @arc_start 还有就是,部署到生产环境,你是需要预编译资源文件的……

Cannot stat '/home/wyl/Hack/config.ru': Permission denied (errno=13);
需要 登录 后方可回复, 如果你还没有账号请 注册新账号